field-ruler.wxml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <wxs module="_">
  2. module.exports.formatter = function (value, precision) {
  3. console.log(value, precision);
  4. return value;
  5. }
  6. </wxs>
  7. <!--module/health/components/field-ruler/field-ruler.wxml-->
  8. <view class="field-picker" bind:tap="onShow">
  9. <view class="field-picker__inner">
  10. <view wx:if="{{selected.length}}" class="scrollbar">
  11. <view class="item" wx:for="{{options}}" wx:key="*this">
  12. <text name="{{item.name}}">{{_.formatter(selected[index], options[index].precision)}}</text>
  13. <text style="margin-left: 2px;">{{item.unit}}</text>
  14. </view>
  15. </view>
  16. <view wx:else class=" placeholder">请选择</view>
  17. </view>
  18. </view>
  19. <input style="opacity: 0;" type="digit" wx:for="{{options}}" wx:key="id" name="{{item.id}}" value="{{selected[index]}}" />
  20. <t-popup visible="{{visible}}" bind:visible-change="onCancel" placement="bottom" close-on-overlay-click="{{closeOnOverlayClick}}">
  21. <view class="popup__header">
  22. <view class="btn btn--cancel" aria-role="button" bind:tap="onCancel">取消</view>
  23. <view class="title">{{title}}</view>
  24. <view class="btn btn--confirm" aria-role="button" bind:tap="onConfirm">确定</view>
  25. </view>
  26. <view class="popup__content">
  27. <form-ruler wx:for="{{options}}" min="{{item.min}}" max="{{item.max}}" precision="{{item.precision}}" model:value="{{scrollValue[index]}}" default-value="{{visible ? selected[index] : 0}}" line="{{item.markLine}}">
  28. <view slot="before" wx:if="{{item.name !== title}}">{{item.name}}</view>
  29. <view slot="after">{{item.unit}}</view>
  30. </form-ruler>
  31. </view>
  32. </t-popup>