Component({
  properties: {
    // 定义接收父组件传入的currIndex
    currIndex: {
      type: Number,
      value: 0 // 默认值
    }
  },
  data: {
    menu: [{
        index: 0,
        name: "时记",
        icon: "mj--mute",
        select: "mj--smile"
      },
      {
        index: 1,
        name: "树洞",
        icon: "mj--thinking",
        select: "mj--cool"
      },
      {
        index: 2,
        name: "分享",
        icon: "mj--expressionless",
        select: "mj--kiss"
      },
      {
        index: 3,
        name: "我的",
        icon: "mj--sleeping",
        select: "mj--unamused"
      },
    ],
  },
  methods: {
    tabClick(e) {
      let {
        index
      } = e.currentTarget.dataset;
      this.setData({
        currIndex: index,
      })
      this.triggerEvent('tabChange', index)
    },
  }
})