Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

WeChat widget form component radio


May 18, 2021 WeChat Mini Program Development Document


Table of contents


WeChat small program single-box radio

radio-group

A single selector, which consists <radio/> internals.

The property name Type The default Description
bindchange EventHandle The change event is triggered when the selected item in the radio-group/gt; event.detail is triggered, event.detail is the value: the value of the selected item radio.

radio


Single-choice items

The property name Type The default Description
value String The identification of <radio/> When <radio/> the change event of <radio-group/> will carry the value of the <radio/>
checked Boolean false Whether it is currently selected
disabled Boolean false Whether to disable
color Color Radio color, color with css

<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: '美国'},
      {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)
  }
})

WeChat widget form component radio