#小程序 带文字的选择项

#小程序 带文字的选择项_第1张图片


wxml


      {{item.name}}
      
        {{agelist.age}}

        {{agelist.age}}
      
    

js

    data:{
    selectmomid:"1234",
    selectbabyid: "2234",
    
    info_list_age: [{ name: '妈妈年龄段', id: 0, selected: false, agelist: [{ age: '30岁以下', index: 0 }, { age: '30-40', index: 1 }, { age: '40岁以上', index: 2 }] }, { name: '宝宝年龄段', selected: false, id: 1, agelist: [{ age: '3个月以下', index: 0 }, { age: '3-6个月', index: 1 }, { age: '6个月以上', index: 2}] }],
    
  },
  radioChange: function (e) {
    console.log('radio发生change事件,携带value值为:', e.detail.value)
  },
  selectvalue:function(e){
    console.log(e)
    console.log(this.data.selectbabyid)
    
    var id   = e.currentTarget.dataset.id
    var index = e.currentTarget.dataset.index
    if(id==0){
      this.setData({
        selectmomid: index
      })
    }else{
      console.log(123)
      this.setData({
        selectbabyid: index
      })
    },
onLoad: function (options) {
console.log( this .data.info_list_age)
},

你可能感兴趣的:(小程序)