lll
liukangdong
2024-07-31 7b2847ac00849ffe33e4b1ca186fd9b6ad312dad
wechat_jiaxuan/components/disProduct/index.js
@@ -1,4 +1,5 @@
import { getCatalogList, getCataLogTagList, getZhongTaiProductPage } from '../../api/index'
import { eventBus } from '../../utils/eventBus'
Component({
  /**
   * 组件的属性列表
@@ -25,6 +26,22 @@
    sortType: '',
    catalogCode: ""
  },
  pageLifetimes: {
    show: function() {
      // 页面被展示
      console.log('组件被展示');
      eventBus.once('productDeBack', (info) => {
        const datalist = this.data.datalist
        datalist.forEach(item => {
          if(item.id === info.id){
            item.isCollection = info.isCollection
            item.viewCount ++
          }
        })
        this.setData({ datalist })
      })
    },
  },
  attached() {
    this.getCatelist()
    var app = getApp()