index.wxml 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <!--components/input/index.wxml-->
  2. <!-- 单行文本 -->
  3. <van-cell border="{{ false }}" class="label-sm" wx:if="{{type == 'text'}}">
  4. <view slot="title">
  5. <text class="{{value?'text-green':'text-red'}}" wx:if="{{isRequired}}">*</text>
  6. <text class="van-cell-text">{{title}}</text>
  7. </view>
  8. <input type="{{inputType}}" maxlength="{{maxLength}}" value="{{value}}" placeholder="{{placeholder}}" bindinput="getValue" disabled="{{disabled}}" />
  9. </van-cell>
  10. <!-- 多行文本 -->
  11. <van-cell border="{{ false }}" class="label-sm" wx:if="{{type === 'textarea'}}">
  12. <view slot="title">
  13. <text class="{{value?'text-green':'text-red'}}">*</text>
  14. <text class="van-cell-text">{{title}}</text>
  15. </view>
  16. <textarea style="width: 100%;" value="{{value}}" placeholder="{{placeholder}}" auto-height="{{true}}" bindinput="getValue" disabled="{{disabled}}" />
  17. </van-cell>
  18. <!-- 日期选择器 -->
  19. <van-cell border="{{ false }}" class="label-sm" wx:if="{{type === 'date'}}">
  20. <view slot="title">
  21. <text wx:if="{{isRequired}}" class="{{value?'text-green':'text-red'}}">*</text>
  22. <text class="van-cell-text">{{title}}</text>
  23. </view>
  24. <picker class="picker" mode="date" value="{{value}}" data-type="date" start="{{startDate}}" end="{{endDate}}" bindchange="getValue" disabled="{{disabled}}">
  25. <text class="pick-text">{{value ?value:placeholder}}</text>
  26. <van-icon class="icon" name="arrow" />
  27. </picker>
  28. </van-cell>
  29. <!-- 时间选择器 -->
  30. <van-cell border="{{ false }}" class="label-sm" wx:if="{{type === 'time' }}">
  31. <view slot="title">
  32. <text wx:if="{{isRequired}}" class="{{value?'text-green':'text-red'}}">*</text>
  33. <text class="van-cell-text">{{title}}</text>
  34. </view>
  35. <picker class="picker" mode="time" value="{{value}}" data-type="time" bindchange="getValue" disabled="{{disabled}}" start="{{startTime}}" end="{{endTime}}">
  36. <text class="pick-text">{{value ?value:placeholder}}</text>
  37. <van-icon class="icon" name="arrow" />
  38. </picker>
  39. </van-cell>
  40. <!-- 计数器 -->
  41. <van-cell border="{{ false }}" class="label-sm" wx:if="{{type === 'stepper'}}">
  42. <view slot="title">
  43. <text wx:if="{{isRequired}}" class="{{value?'text-green':'text-red'}}">*</text>
  44. <text class="van-cell-text">{{title}}</text>
  45. </view>
  46. <van-stepper value="{{ value }}" bind:change="getValue" data-type="1" integer max="{{stepperMax}}" min="{{1}}" />
  47. </van-cell>
  48. <!-- 单选 -->
  49. <van-cell border="{{ false }}" class="label-sm" wx:if="{{type === 'radio'}}" title-width="200rpx">
  50. <view slot="title">
  51. <text class="{{value?'text-green':'text-red'}}" wx:if="{{isRequired}}">*</text>
  52. <text class="van-cell-text">{{title}}</text>
  53. </view>
  54. <van-radio-group value="{{ value }}" bind:change="getValue" data-type="1">
  55. <van-radio class="dis" wx:for="{{listErgodic}}" wx:key="index" name="{{item[key1]}}">{{item[name1]}}</van-radio>
  56. </van-radio-group>
  57. </van-cell>
  58. <!-- 单张照片 -->
  59. <van-cell border="{{ false }}" class="label-sm" wx:if="{{type === 'image'}}">
  60. <view slot="title">
  61. <text class="{{value?'text-green':'text-red'}}" wx:if="{{isRequired}}">*</text>
  62. <text class="van-cell-text">{{title}}</text>
  63. </view>
  64. <view bindtap="ChooseImage" class="img">
  65. <view wx:if="{{value}}" class="have-photo">
  66. <image src="{{value}}" />
  67. <van-icon name="clear" size="40rpx" class="clear-icon" catchtap="clearImg" />
  68. </view>
  69. <view wx:else class="default-photo">
  70. <van-icon name="photo-o" size="50rpx" color="#E0E1E5" />
  71. </view>
  72. </view>
  73. </van-cell>