Micro letter applet click Copy function

wx.setClipboardData ({ 
Data: 'This is the text to be copied' , 
Success: function (RES) { 
wx.showModal ({ 
title: 'prompt' , 
Content: 'copy success' , 
showCancel: to false 
}); 
} 
})
copy(){
            wx.setClipboardData({
                data: this.order.orderCode,
                success: function (res) {
                    wx.getClipboardData({
                        success: function (res) {
                            wx.showToast({
                                title: '复制成功'
                            })
                        }
                    })
                }
            })
        },
copyText(e){
            api.me.createCode().then(data => {
                console.log('创建邀请码', data)
                this.count++
                this.list.unshift(data.code)

                wx.setClipboardData({
                data: data.code.inviteCode,
                success: function (res) {
                    wx.getClipboardData({
                        success: function (res) {
                            wx.showToast({
                                title: '复制成功'
                            })
                        }
                    })
                }
                })
            })
        },

 

Guess you like

Origin www.cnblogs.com/ll15888/p/11521482.html