index.wxml 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. selection-end="{{ selectionEnd }}"
  35. selection-start="{{ selectionStart }}"
  36. bindinput="onInput"
  37. bind:blur="onBlur"
  38. bind:focus="onFocus"
  39. bind:confirm="onConfirm"
  40. >
  41. </textarea>
  42. <input
  43. wx:else
  44. class="input-class {{ utils.bem('field__input', [inputAlign, { disabled, error }]) }}"
  45. type="{{ type }}"
  46. focus="{{ focus }}"
  47. value="{{ value }}"
  48. disabled="{{ disabled || readonly }}"
  49. maxlength="{{ maxlength }}"
  50. placeholder="{{ placeholder }}"
  51. placeholder-style="{{ placeholderStyle }}"
  52. placeholder-class="{{ utils.bem('field__placeholder', { error }) }}"
  53. confirm-type="{{ confirmType }}"
  54. confirm-hold="{{ confirmHold }}"
  55. cursor-spacing="{{ cursorSpacing }}"
  56. adjust-position="{{ adjustPosition }}"
  57. selection-end="{{ selectionEnd }}"
  58. selection-start="{{ selectionStart }}"
  59. password="{{ password || type === 'password' }}"
  60. bindinput="onInput"
  61. bind:blur="onBlur"
  62. bind:focus="onFocus"
  63. bind:confirm="onConfirm"
  64. />
  65. <van-icon
  66. wx:if="{{ clearable && focused && value && !readonly }}"
  67. size="16px"
  68. name="clear"
  69. class="van-field__clear-root van-field__icon-root"
  70. bindtouchstart="onClear"
  71. />
  72. <view class="van-field__icon-container" bind:tap="onClickIcon">
  73. <van-icon
  74. wx:if="{{ rightIcon || icon }}"
  75. size="16px"
  76. name="{{ rightIcon || icon }}"
  77. class="van-field__icon-root {{ iconClass }}"
  78. custom-class="right-icon-class"
  79. />
  80. <slot name="right-icon" />
  81. <slot name="icon" />
  82. </view>
  83. <view class="van-field__button">
  84. <slot name="button" />
  85. </view>
  86. </view>
  87. <view wx:if="{{ errorMessage }}" class="van-field__error-message {{ utils.bem('field__error', [errorMessageAlign, { disabled, error }]) }}">
  88. {{ errorMessage }}
  89. </view>
  90. </van-cell>