index.wxml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <wxs src="../wxs/utils.wxs" module="utils" />
  2. <wxs src="./index.wxs" module="computed" />
  3. <van-cell size="{{ size }}" icon="{{ leftIcon }}" center="{{ center }}" border="{{ border }}" is-link="{{ isLink }}" required="{{ required }}" clickable="{{ clickable }}" title-width="{{ titleWidth }}" title-style="margin-right: 12px;" custom-style="{{ customStyle }}" arrow-direction="{{ arrowDirection }}" custom-class="van-field" title-class="label-class">
  4. <slot name="left-icon" slot="icon" />
  5. <view wx:if="{{ label }}" class="label-class {{ utils.bem('field__label', { disabled }) }}" catchtap="toCopy" slot="title">
  6. {{ label }}
  7. </view>
  8. <slot wx:else name="label" slot="title" />
  9. <view class="{{ utils.bem('field__body', [type]) }}">
  10. <textarea wx:if="{{ type === 'textarea' }}" class="input-class {{ utils.bem('field__input', [inputAlign, type, { disabled, error }]) }}" fixed="{{ fixed }}" focus="{{ focus }}" cursor="{{ cursor }}" value="{{ innerValue }}" auto-focus="{{ autoFocus }}" disabled="{{ disabled || readonly }}" maxlength="{{ maxlength }}" placeholder="{{ placeholder }}" placeholder-style="{{ placeholderStyle }}" placeholder-class="{{ utils.bem('field__placeholder', { error, disabled }) }}" auto-height="{{ !!autosize }}" style="{{ computed.inputStyle(autosize) }}" cursor-spacing="{{ cursorSpacing }}" adjust-position="{{ adjustPosition }}" show-confirm-bar="{{ showConfirmBar }}" hold-keyboard="{{ holdKeyboard }}" selection-end="{{ selectionEnd }}" selection-start="{{ selectionStart }}" disable-default-padding="{{ disableDefaultPadding }}" bindinput="onInput" bindblur="onBlur" bindfocus="onFocus" bindconfirm="onConfirm" bindlinechange="onLineChange" bindkeyboardheightchange="onKeyboardHeightChange">
  11. </textarea>
  12. <view wx:else style="display: flex;width: 100%;" bind:tap="onBindInput">
  13. <slot name="inputbefor" slot="inputbefor" />
  14. <input class="input-class {{ utils.bem('field__input', [inputAlign, { disabled, error }]) }}" type="{{ type }}" focus="{{ focus }}" cursor="{{ cursor }}" value="{{ innerValue }}" auto-focus="{{ autoFocus }}" disabled="{{ disabled || readonly }}" maxlength="{{ maxlength }}" placeholder="{{ placeholder }}" placeholder-style="{{ placeholderStyle }}" placeholder-class="{{ utils.bem('field__placeholder', { error }) }}" confirm-type="{{ confirmType }}" confirm-hold="{{ confirmHold }}" hold-keyboard="{{ holdKeyboard }}" cursor-spacing="{{ cursorSpacing }}" adjust-position="{{ adjustPosition }}" selection-end="{{ selectionEnd }}" selection-start="{{ selectionStart }}" password="{{ password || type === 'password' }}" bindinput="onInput" bindblur="onBlur" bindfocus="onFocus" bindconfirm="onConfirm" bindkeyboardheightchange="onKeyboardHeightChange" />
  15. </view>
  16. <slot name="end" slot="end" />
  17. <van-icon wx:if="{{ showClear }}" name="clear" class="van-field__clear-root van-field__icon-root" catch:touchstart="onClear" />
  18. <view class="van-field__icon-container" catchtap="onClickIcon">
  19. <van-icon wx:if="{{ rightIcon || icon }}" name="{{ rightIcon || icon }}" class="van-field__icon-root {{ iconClass }}" custom-class="right-icon-class" />
  20. <slot name="right-icon" />
  21. <slot name="icon" />
  22. </view>
  23. <view class="van-field__button">
  24. <slot name="button" />
  25. </view>
  26. <slot name="own" />
  27. </view>
  28. <view wx:if="{{ showWordLimit && maxlength }}" class="van-field__word-limit">
  29. <view class="{{ utils.bem('field__word-num', { full: value.length >= maxlength }) }}">{{ value.length > maxlength?maxlength:value.length }}</view>/{{ maxlength }}
  30. </view>
  31. <view wx:if="{{ errorMessage }}" class="{{ utils.bem('field__error-message', [errorMessageAlign, { disabled, error }]) }}">
  32. {{ errorMessage }}
  33. </view>
  34. </van-cell>