支付寶小程序API 剪貼板

2018-11-27 20:03 更新

my.getClipboard

獲取剪貼板數(shù)據(jù)。

入?yún)?/h3>
名稱 類型 必填 描述
success Function 調(diào)用成功的回調(diào)函數(shù)
fail Function 調(diào)用失敗的回調(diào)函數(shù)
complete Function 調(diào)用結(jié)束的回調(diào)函數(shù)(調(diào)用成功、失敗都會(huì)執(zhí)行)

success 返回值

名稱 類型 描述
text String 剪貼板數(shù)據(jù)

代碼示例

Page({
  data: {
    text: '3.1415926',
    copy: '',
  },

  
  handlePaste() {
    my.getClipboard({
      success: ({ text }) => {
        this.setData({ copy: text });
      },
    });
  },
});

my.setClipboard

設(shè)置剪貼板數(shù)據(jù)。

入?yún)?/h3>
名稱 類型 必填 描述
text String 剪貼板數(shù)據(jù)
success Function 調(diào)用成功的回調(diào)函數(shù)
fail Function 調(diào)用失敗的回調(diào)函數(shù)
complete Function 調(diào)用結(jié)束的回調(diào)函數(shù)(調(diào)用成功、失敗都會(huì)執(zhí)行)

代碼示例

Page({
  data: {
    text: '3.1415926',
    copy: '',
  },


  handleCopy() {
    my.setClipboard({
      text: this.data.text,
    });
  },
});
以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)