码迷,mamicode.com
首页 > 微信 > 详细

微信小程序中实现点击复制的功能

时间:2018-09-28 20:33:24      阅读:303      评论:0      收藏:0      [点我收藏+]

标签:detail   nbsp   OLE   UNC   set   text   成功   func   getc   

js中:
textPaste(){ wx.showToast({ title:
‘复制成功‘, }) wx.setClipboardData({ data: 点击复制的内容, success: function (res) { wx.getClipboardData({ 这个api是把拿到的数据放到电脑系统中的 success: function (res) { console.log(res.data) // data } }) } }) },
wxml中:
<text class=‘shopName‘ bindtap=‘textPaste‘>{{shopDetailList.shopName}}</text>

如果想看是否成功 可以直接点击完后去你的编辑框里面的看看Ctrl+v 和右键粘贴能不能 把

点击复制的内容 

给复制上去。

 

微信小程序中实现点击复制的功能

标签:detail   nbsp   OLE   UNC   set   text   成功   func   getc   

原文地址:https://www.cnblogs.com/xuhuang/p/9720337.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!