good-tab.js 872 Bytes
// components/good-tab/good-tab.js
Component({
    /**
     * 组件的属性列表
     */
    properties: {
        tab: Array,
        openScroll: Boolean,
        index: {
          type: Number,
          observer: function (n) {
            this.setData({
              count: n,
              to: `to-${n}`
            })
          }
        },
        align: {
          type: String,
          default: ''
        }
    },
  
    /**
     * 组件的初始数据
     */
    data: {
      count: 0,
      to: '',
      IMGURL: wx.$imgUrl
    },
    attached() {
  
    },
    /**
     * 组件的方法列表
     */
    methods: {
      click(e) {
        let {
            count
        } = e.currentTarget.dataset
        this.setData({
            count,
            to: `to-${count}`
        })
        this.triggerEvent('click', count)
      }
    }
  })