index.wxml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <wxs src="../wxs/utils.wxs" module="utils" />
  2. <van-cell
  3. size="{{ size }}"
  4. icon="{{ leftIcon }}"
  5. title="{{ label }}"
  6. center="{{ center }}"
  7. border="{{ border }}"
  8. is-link="{{ isLink }}"
  9. required="{{ required }}"
  10. clickable="{{ clickable }}"
  11. title-width="{{ titleWidth }}"
  12. custom-style="{{ customStyle }}"
  13. arrow-direction="{{ arrowDirection }}"
  14. custom-class="van-field"
  15. >
  16. <slot name="left-icon" slot="icon" />
  17. <slot name="label" slot="title" />
  18. <view class="{{ utils.bem('field__body', [type, system]) }}">
  19. <textarea
  20. wx:if="{{ type === 'textarea' }}"
  21. class="input-class {{ utils.bem('field__input', [inputAlign, type, { disabled, error }]) }}"
  22. fixed="{{ fixed }}"
  23. focus="{{ focus }}"
  24. value="{{ value }}"
  25. disabled="{{ disabled || readonly }}"
  26. maxlength="{{ maxlength }}"
  27. placeholder="{{ placeholder }}"
  28. placeholder-style="{{ placeholderStyle }}"
  29. placeholder-class="{{ utils.bem('field__placeholder', { error }) }}"
  30. auto-height="{{ autosize }}"
  31. cursor-spacing="{{ cursorSpacing }}"
  32. adjust-position="{{ adjustPosition }}"
  33. show-confirm-bar="{{ showConfirmBar }}"
  34. hold-keyboard="{{ holdKeyboard }}"
  35. selection-end="{{ selectionEnd }}"
  36. selection-start="{{ selectionStart }}"
  37. bindinput="onInput"
  38. bind:blur="onBlur"
  39. bind:focus="onFocus"
  40. bind:confirm="onConfirm"
  41. >
  42. </textarea>
  43. <input
  44. wx:else
  45. class="input-class {{ utils.bem('field__input', [inputAlign, { disabled, error }]) }}"
  46. type="{{ type }}"
  47. focus="{{ focus }}"
  48. value="{{ value }}"
  49. disabled="{{ disabled || readonly }}"
  50. maxlength="{{ maxlength }}"
  51. placeholder="{{ placeholder }}"
  52. placeholder-style="{{ placeholderStyle }}"
  53. placeholder-class="{{ utils.bem('field__placeholder', { error }) }}"
  54. confirm-type="{{ confirmType }}"
  55. confirm-hold="{{ confirmHold }}"
  56. hold-keyboard="{{ holdKeyboard }}"
  57. cursor-spacing="{{ cursorSpacing }}"
  58. adjust-position="{{ adjustPosition }}"
  59. selection-end="{{ selectionEnd }}"
  60. selection-start="{{ selectionStart }}"
  61. password="{{ password || type === 'password' }}"
  62. bindinput="onInput"
  63. bind:blur="onBlur"
  64. bind:focus="onFocus"
  65. bind:confirm="onConfirm"
  66. />
  67. <van-icon
  68. wx:if="{{ clearable && focused && value && !readonly }}"
  69. size="16px"
  70. name="clear"
  71. class="van-field__clear-root van-field__icon-root"
  72. bindtouchstart="onClear"
  73. />
  74. <view class="van-field__icon-container" bind:tap="onClickIcon">
  75. <van-icon
  76. wx:if="{{ rightIcon || icon }}"
  77. size="16px"
  78. name="{{ rightIcon || icon }}"
  79. class="van-field__icon-root {{ iconClass }}"
  80. custom-class="right-icon-class"
  81. />
  82. <slot name="right-icon" />
  83. <slot name="icon" />
  84. </view>
  85. <view class="van-field__button">
  86. <slot name="button" />
  87. </view>
  88. </view>
  89. <view wx:if="{{ errorMessage }}" class="van-field__error-message {{ utils.bem('field__error', [errorMessageAlign, { disabled, error }]) }}">
  90. {{ errorMessage }}
  91. </view>
  92. </van-cell>