博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
小程序点击复制如何实现
阅读量:7144 次
发布时间:2019-06-29

本文共 765 字,大约阅读时间需要 2 分钟。

 

wx.setClipboardData({

data: 'data',

success: function(res) {

wx.getClipboardData({

success: function(res) {

console.log(res.data) // data

}

})

}

})

 

将要复制的内容放到data里面即可。

 

 

获取系统剪贴板的内容

wx.getClipboardData({
success: function(res){
console.log(res.data)
}
})

 

 

Demo:

<text class="tblin_items_txt" selectable="true">{

{detail.taokouling||''}}</text> <!-- 复制的对象-->

<view class="tblin_items_btn" bindtap="copyTBL">一键复制</view><!-- 复制操作 -->

 

Js:

copyTBL:function(e){

var self=this;

wx.setClipboardData({

data: self.data.taokouling,

success: function(res) {

// self.setData({copyTip:true}),

wx.showModal({

title: '提示',

content: '复制成功',

success: function(res) {

if (res.confirm) {

console.log('确定')

} else if (res.cancel) {

console.log('取消')

}

}

})

}

});

}

 

 

文章来源:

欢迎关注,有问题一起学习欢迎留言、评论。

转载地址:http://jegrl.baihongyu.com/

你可能感兴趣的文章
使用qemu
查看>>
2019PKU\THU WC题解
查看>>
C++中accumulate的用法
查看>>
linux下查找可执行文件
查看>>
5.4.5 索引
查看>>
django分页查询并返回jsons数据
查看>>
git本地已有文件夹和远程仓库对应
查看>>
Codeforces Round #437 (Div. 2, based on MemSQL Start[c]UP 3.0 - Round 2)
查看>>
rsa Round #71 (Div. 2 only)
查看>>
python学习9
查看>>
面试需要掌握的技能
查看>>
[BZOJ2693]jzptab
查看>>
[CF1043G]Speckled Band
查看>>
游戏类书籍
查看>>
Django的时间字段DateTimeField
查看>>
VMware 报错“Intel VT-x处于禁止状态”
查看>>
nginx负载均衡 加权轮询和ip_hash
查看>>
mybatis的xml配置中if text判断不为0
查看>>
ML科普系列(一)训练集、测试集和验证集
查看>>
pymongo 操作
查看>>