WeChat Open Platform

Mini Programs Documentation

radio-group

Single selector, composed of multiple <radio/>s internally.

Attribute name Type Default value Description
bindchange EventHandle A change event triggered when a selected item in <radio-group/> changes, event.detail = {value: value of selected item radio}

radio

Radio item

Attribute name Type Default value Description
value String <radio/> ID. When this <radio/> is selected, a <radio-group/> change event will bring the <radio/> value.
checked Boolean false Whether currently selected
disabled Boolean false Whether disabled
color Color radio color, same as css color
<radio-group class="radio-group" bindchange="radioChange">
  <label class="radio" wx:for="{{items}}">
    <radio value="{{item.name}}" checked="{{item.checked}}"/>{{item.value}}
  </label>
</radio-group>
Page({
  data: {
    items: [
      {name: 'USA', value: 'USA'},
      {name: 'CHN', value: 'China', checked: 'true'},
      {name: 'BRA', value: 'Brazil'},
      {name: 'JPN', value: 'Japan'},
      {name: 'ENG', value: 'England'},
      {name: 'TUR', value: 'France'},
    ]
  },
  radioChange: function(e) {
    console.log('when a radio change event occurs, the value brought is:', e.detail.value)
  }
})

radio