index.wxml 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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="search"
  12. focus="{{ focus }}"
  13. error="{{ error }}"
  14. border="{{ false }}"
  15. confirm-type="search"
  16. class="van-search__field field-class"
  17. value="{{ value }}"
  18. disabled="{{ disabled }}"
  19. readonly="{{ readonly }}"
  20. clearable="{{ clearable }}"
  21. maxlength="{{ maxlength }}"
  22. input-align="{{ inputAlign }}"
  23. input-class="input-class"
  24. placeholder="{{ placeholder }}"
  25. placeholder-style="{{ placeholderStyle }}"
  26. custom-style="padding: 5px 10px 5px 0; background-color: transparent;"
  27. bind:blur="onBlur"
  28. bind:focus="onFocus"
  29. bind:change="onChange"
  30. bind:confirm="onSearch"
  31. bind:clear="onClear"
  32. />
  33. </view>
  34. <view
  35. wx:if="{{ showAction || useActionSlot }}"
  36. class="van-search__action"
  37. hover-class="van-search__action--hover"
  38. hover-stay-time="70"
  39. >
  40. <slot wx:if="{{ useActionSlot }}" name="action" />
  41. <view wx:else bind:tap="onCancel" class="cancel-class">取消</view>
  42. </view>
  43. </view>