Select.js 724 Bytes
// packageMine/pages/questionnaire/components/Select/Select.js
Component({

  /**
   * 组件的属性列表
   */
  properties: {
    data: Array,
    title: String,
    num: Number
  },

  /**
   * 组件的初始数据
   */
  data: {
    value: '',
    show: false
  },

  /**
   * 组件的方法列表
   */
  methods: {
    onClick() {
      this.setData({
        show: true,
      })
    },

    onClose() {
      this.setData({
        show: false
      })
    },
    onConfirm(e) {
      const {
        value
      } = e.detail, {
        num
      } = this.data
      this.setData({
        value
      })
      this.triggerEvent('change', {
        num,
        value
      })
      this.onClose()
    }
  }
})