// components/receive/receive.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    list: [{
        text: '邮箱',
        value: 1,
        selected: true
      },
      {
        text: '手机短信',
        value: 2,
        selected: false
      }/* ,
      {
        text: '微信卡包',
        value: 3,
        selected: false
      },
      {
        text: '支付宝发票管家',
        value: 4,
        selected: false
      } */
    ],
  },

  /**
   * 组件的方法列表
   */
  methods: {
    select(e) {
      let index = Number(e.currentTarget.dataset.index)
      let list = this.data.list
      for (let i = 0; i < list.length; i++) {
        list[i].selected = false
      }
      list[index].selected = true
      this.setData({
        list
      })
      let value = list[index].value
      this.triggerEvent('select', {
        value
      })
    }
  }
})