index.wxml 2.2 KB

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