tabbar.js 563 Bytes
// components/tabbar.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    list: Array,
    flex: null,
    defaultIndex: {
      type: Number,
      observer: function (n, o) {
        this.setData({
          count: n
        })
      }
    },
  },

  /**
   * 组件的初始数据
   */
  data: {
    count: 0,
  },

  /**
   * 组件的方法列表
   */
  methods: {
    click(e){
      let index = e.currentTarget.dataset.index
      this.setData({
        count:  index
      })
      this.triggerEvent('tabclick', index)
    }
  }
})