index.wxml 1.9 KB

123456789101112131415161718192021222324252627
  1. <wux-popup position="bottom" visible="{{ in }}" bind:close="onCancel">
  2. <view class="{{ classes.wrap }}">
  3. <view class="{{ classes.toolbar }}" wx:if="{{ toolbar }}">
  4. <view class="{{ classes.inner }}">
  5. <view class="{{ classes.cancel }}" hover-class="{{ classes.hover }}" bindtap="onCancel" wx:if="{{ toolbar.cancelText }}">{{ toolbar.cancelText }}</view>
  6. <view class="{{ classes.title }}">{{ toolbar.title }}</view>
  7. <view class="{{ classes.confirm }}" hover-class="{{ classes.hover }}" bindtap="onConfirm" wx:if="{{ toolbar.confirmText }}">{{ toolbar.confirmText }}</view>
  8. </view>
  9. </view>
  10. <scroll-view scroll-y scroll-into-view="{{ activeIndex }}" class="{{ classes.scrollView }}">
  11. <wux-radio-group value="{{ value }}" bind:change="onRadioChange" wx:if="{{ !multiple }}">
  12. <block wx:for="{{ common.getItems(options) }}" wx:key="index">
  13. <wux-radio id="{{ 'select-' + index }}" color="{{ item.color }}" thumb="{{ item.thumb }}" title="{{ item.title }}" label="{{ item.label }}" disabled="{{ item.disabled }}" value="{{ item.value }}" />
  14. </block>
  15. </wux-radio-group>
  16. <wux-checkbox-group value="{{ value }}" bind:change="onCheckboxChange" wx:else>
  17. <block wx:for="{{ common.getItems(options) }}" wx:key="index">
  18. <wux-checkbox id="{{ 'select-' + index }}" color="{{ item.color }}" extra="{{ item.extra }}" title="{{ item.title }}" label="{{ item.label }}" disabled="{{ item.disabled }}" value="{{ item.value }}" />
  19. </block>
  20. </wux-checkbox-group>
  21. </scroll-view>
  22. </view>
  23. </wux-popup>
  24. <wxs module="common">
  25. module.exports.getItems = function(array) { return array.map(function(n) { if (n.constructor !== 'Object') { return { value: n, title: n } } return n }) }
  26. </wxs>