WeChat mini program form component radio


radio-group

Single selection group, internally composed of multiple radio

QQ截图20170208102937.png

radio


Single choice item

QQ截图20170208102950.png

<radio-group class="radio-group" bindchange="radioChange">
    <label class="radio" wx:for-items="{{items}}">
        <radio value="{{item.name}}" checked="{{item.checked}}"/>{{item.value}}
    </label>
</radio-group>
Page({
  data: {
    items: [
      {name: 'USA', value: '美国'},
      {name: 'CHN', value: '中国', checked: 'true'},
      {name: 'BRA', value: '巴西'},
      {name: 'JPN', value: '日本'},
      {name: 'ENG', value: '英国'},
      {name: 'TUR', value: '法国'},
    ]
  },
  radioChange: function(e) {
    console.log('radio发生change事件,携带value值为:', e.detail.value)
  }
})

201609231159027205.png