index.wxml 2.0KB

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