// pages/component/prizeDetailShow/prizeDetailShow.js const app = getApp() Component({ /** * 组件的属性列表 */ properties: { topValue:{ type:Number, value:550 }, datas:{ type:Object, value:{} } }, /** * 组件的初始数据 */ data: { imgUrl: app.globalData.urlStatic,//图片路径 }, attached:function(){ console.log(this.data.datas); }, /** * 组件的方法列表 */ methods: { copyExchangeCode: function (e) { var type = e.currentTarget.dataset.type; if(type==1){ var text = this.data.datas.couponCode; }else{ var text = this.data.datas.couponSecret; } this.contentCopy(text); }, contentCopy: function (text) {//内容复制 wx.setClipboardData({ data: text }) } } })