index.wxml 2.9 KB

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