1234567891011121314151617181920212223242526272829303132333435363738
  1. <view
  2. class="van-search custom-class {{ showAction || useActionSlot ? 'van-search--show-action' : '' }}"
  3. style="background: {{ background }}"
  4. >
  5. <van-field
  6. clearable
  7. type="search"
  8. left-icon="search"
  9. focus="{{ focus }}"
  10. error="{{ error }}"
  11. border="{{ false }}"
  12. confirm-type="search"
  13. class="van-search__field field-class"
  14. value="{{ value }}"
  15. disabled="{{ disabled }}"
  16. readonly="{{ readonly }}"
  17. maxlength="{{ maxlength }}"
  18. input-align="{{ inputAlign }}"
  19. input-class="input-class"
  20. placeholder="{{ placeholder }}"
  21. placeholder-style="{{ placeholderStyle }}"
  22. custom-style="padding: 3px 10px"
  23. bind:blur="onBlur"
  24. bind:focus="onFocus"
  25. bind:change="onChange"
  26. bind:confirm="onSearch"
  27. bind:clear="onClear"
  28. />
  29. <view
  30. wx:if="{{ showAction || useActionSlot }}"
  31. class="van-search__action"
  32. hover-class="van-search__action--hover"
  33. hover-stay-time="70"
  34. >
  35. <slot wx:if="{{ useActionSlot }}" name="action" />
  36. <view wx:else bind:tap="onCancel" class="cancel-class">取消</view>
  37. </view>
  38. </view>