1234567891011121314151617181920212223242526 |
- <wux-cell-group id="wux-cell-group" wux-class="{{ prefixCls }}" prefixCls="{{ cellGroupPrefixCls }}" title="{{ title }}" label="{{ label }}">
- <block wx:for="{{ common.getOptions(options) }}" wx:for-item="option" wx:key="" wx:if="{{ options.length > 0 }}">
- <wux-checkbox
- prefixCls="{{ option.prefixCls || 'wux-checkbox' }}"
- cellPrefixCls="{{ option.cellPrefixCls || 'wux-cell' }}"
- selectablePrefixCls="{{ option.selectablePrefixCls || 'wux-selectable' }}"
- title="{{ option.title }}"
- label="{{ option.label }}"
- extra="{{ option.extra }}"
- value="{{ option.value }}"
- checked="{{ common.getChecked(inputValue, option) }}"
- disabled="{{ option.disabled }}"
- color="{{ option.color || 'balanced' }}"
- data-index="{{ index }}"
- bind:change="onCheckboxChange"
- />
- </block>
- <block wx:if="{{ options.length === 0 }}">
- <slot></slot>
- </block>
- </wux-cell-group>
- <wxs module="common">
- module.exports.getOptions = function(options) { return options.map(function(option) { if (option.constructor === 'String') { return { title: option, value: option } } return option }) }
- module.exports.getChecked = function(values, option) { return values.indexOf(option.value) !== -1 }
- </wxs>
|