index.wxml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <wxs src="../wxs/utils.wxs" module="utils" />
  2. <!-- <wxs src="./index.wxs" module="computed" /> -->
  3. <!-- 没有用的注释 -->
  4. <van-cell
  5. size="{{ size }}"
  6. icon="{{ leftIcon }}"
  7. center="{{ center }}"
  8. border="{{ border }}"
  9. is-link="{{ isLink }}"
  10. required="{{ required }}"
  11. clickable="{{ clickable }}"
  12. title-width="{{ titleWidth }}"
  13. title-style="margin-right: 12px;"
  14. custom-style="{{ customStyle }}"
  15. arrow-direction="{{ arrowDirection }}"
  16. custom-class="van-field"
  17. >
  18. <slot name="left-icon" slot="icon" />
  19. <view wx:if="{{ label }}" class="label-class {{ utils.bem('field__label', { disabled }) }}" slot="title">
  20. {{ label }}
  21. </view>
  22. <slot wx:else name="label" slot="title" />
  23. <view class="{{ utils.bem('field__body', [type]) }}">
  24. <view class="{{ utils.bem('field__control', [inputAlign, 'custom']) }}" bindtap="onClickInput">
  25. <slot name="input" />
  26. </view>
  27. <include wx:if="{{ type === 'textarea' }}" src="./textarea.wxml" />
  28. <include wx:else src="./input.wxml" />
  29. <van-icon
  30. wx:if="{{ showClear }}"
  31. name="{{ clearIcon }}"
  32. class="van-field__clear-root van-field__icon-root"
  33. catch:touchstart="onClear"
  34. />
  35. <view class="van-field__icon-container" bind:tap="onClickIcon">
  36. <van-icon
  37. wx:if="{{ rightIcon || icon }}"
  38. name="{{ rightIcon || icon }}"
  39. class="van-field__icon-root {{ iconClass }}"
  40. custom-class="right-icon-class"
  41. />
  42. <slot name="right-icon" />
  43. <slot name="icon" />
  44. </view>
  45. <view class="van-field__button">
  46. <slot name="button" />
  47. </view>
  48. </view>
  49. <view wx:if="{{ showWordLimit && maxlength }}" class="van-field__word-limit">
  50. <view class="{{ utils.bem('field__word-num', { full: value.length >= maxlength }) }}">{{ value.length >= maxlength ? maxlength : value.length }}</view>/{{ maxlength }}
  51. </view>
  52. <view wx:if="{{ errorMessage }}" class="{{ utils.bem('field__error-message', [errorMessageAlign, { disabled, error }]) }}">
  53. {{ errorMessage }}
  54. </view>
  55. </van-cell>