index.wxml 1.2 KB

12345678910111213141516171819202122232425
  1. <wux-cell-group id="wux-cell-group" wux-class="{{ prefixCls }}" prefixCls="{{ cellGroupPrefixCls }}" title="{{ title }}" label="{{ label }}">
  2. <block wx:for="{{ common.getOptions(options) }}" wx:for-item="option" wx:key="index" wx:if="{{ options.length > 0 }}">
  3. <wux-radio
  4. prefixCls="{{ option.prefixCls || 'wux-radio' }}"
  5. cellPrefixCls="{{ option.cellPrefixCls || 'wux-cell' }}"
  6. selectablePrefixCls="{{ option.selectablePrefixCls || 'wux-selectable' }}"
  7. thumb="{{ option.thumb }}"
  8. title="{{ option.title }}"
  9. label="{{ option.label }}"
  10. value="{{ option.value }}"
  11. checked="{{ inputValue === option.value }}"
  12. disabled="{{ option.disabled }}"
  13. color="{{ option.color || 'balanced' }}"
  14. data-index="{{ index }}"
  15. bind:change="onRadioChange"
  16. />
  17. </block>
  18. <block wx:if="{{ options.length === 0 }}">
  19. <slot></slot>
  20. </block>
  21. </wux-cell-group>
  22. <wxs module="common">
  23. module.exports.getOptions = function(options) { return options.map(function(option) { if (option.constructor === 'String') { return { title: option, value: option } } return option }) }
  24. </wxs>