1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- // myComponents/product/product.js
- const app = getApp()
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- tableData:{
- type:Array,
- value:[],
- observers:function(val){
- console.log(val)
- }
- }
- },
- /**
- * 组件的初始数据
- */
- data: {
- imgHttp:app.globalData.imgHttp
- },
- /**
- * 组件的方法列表
- */
- methods: {
- //查看图片
- previewImage(e) {
- const { current,imglist } = e.currentTarget.dataset
- var imgs = []
- for(var i =0;i<imglist.length;i++){
- imgs.push(this.data.imgHttp + imglist[i].guid)
- }
- current = this.data.imgHttp + current
- wx.previewImage({
- current,
- urls:imgs,
- })
- },
- //打开关注类型
- open(e){
- var index = e.currentTarget.dataset.index
- this.setData({
- ['tableData['+ index + '].show'] : true
- })
- },
- //关闭关注类型
- cancel(e){
- var index = e.currentTarget.dataset.index
- this.setData({
- ['tableData['+ index + '].show'] : false
- })
- },
- //关注
- attention(e){
- var {type,index} = e.currentTarget.dataset
- },
- //监控
- control(e){
- var index = e.currentTarget.dataset.index
- }
- },
- /**
- * 组件的生命周期函数列表
- */
- lifetimes: {
- // 在组件实例进入页面节点树时执行
- attached: function () {
- // 初始化操作
- console.log(this.properties.tableData);
- // ...
- },
- // 在组件实例被移除出页面节点树时执行
- detached: function () {
- // 清理工作
- console.log('组件销毁');
- // ...
- },
- // ...
- },
- })
|