index.wxml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <wxs src="../wxs/utils.wxs" module="utils" />
  2. <view
  3. class="{{ utils.bem('search', { withaction: showAction || useActionSlot }) }} custom-class"
  4. style="background: {{ background }}"
  5. >
  6. <view class="{{ utils.bem('search__content', [shape]) }}">
  7. <view class="van-search__label" wx:if="{{ label }}">{{ label }}</view>
  8. <slot wx:else name="label" />
  9. <van-field
  10. type="search"
  11. left-icon="{{ !useLeftIconSlot ? leftIcon : '' }}"
  12. right-icon="{{ !useRightIconSlot ? rightIcon : '' }}"
  13. focus="{{ focus }}"
  14. error="{{ error }}"
  15. border="{{ false }}"
  16. confirm-type="search"
  17. class="van-search__field field-class"
  18. value="{{ value }}"
  19. disabled="{{ disabled }}"
  20. readonly="{{ readonly }}"
  21. clearable="{{ clearable }}"
  22. clear-trigger="{{ clearTrigger }}"
  23. clear-icon="{{ clearIcon }}"
  24. maxlength="{{ maxlength }}"
  25. input-align="{{ inputAlign }}"
  26. input-class="input-class"
  27. placeholder="{{ placeholder }}"
  28. placeholder-style="{{ placeholderStyle }}"
  29. custom-style="padding: 5px 10px 5px 0; background-color: transparent;"
  30. bind:blur="onBlur"
  31. bind:focus="onFocus"
  32. bind:change="onChange"
  33. bind:confirm="onSearch"
  34. bind:clear="onClear"
  35. bind:click-input="onClickInput"
  36. >
  37. <slot wx:if="{{ useLeftIconSlot }}" name="left-icon" slot="left-icon" />
  38. <slot wx:if="{{ useRightIconSlot }}" name="right-icon" slot="right-icon" />
  39. </van-field>
  40. </view>
  41. <view
  42. wx:if="{{ showAction || useActionSlot }}"
  43. class="van-search__action"
  44. hover-class="van-search__action--hover"
  45. hover-stay-time="70"
  46. >
  47. <slot wx:if="{{ useActionSlot }}" name="action" />
  48. <view wx:else bind:tap="onCancel" class="van-search__action-button cancel-class">{{ actionText }}</view>
  49. </view>
  50. </view>