支付寶小程序複製到剪貼板
my.getClipboard
獲取剪貼板數據。
Page({
data: {
text: '3.1415926',
copy: '',
},
handlePaste() {
my.getClipboard({
success: ({ text }) => {
this.setData({ copy: text });
},
});
},
});
my.setClipboard
設置剪貼板數據。
Page({
data: {
text: '3.1415926',
copy: '',
},
handleCopy() {
my.setClipboard({
text: this.data.text,
});
},
});