search.wxml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <view class="{{classPrefix}} {{prefix}}-class">
  2. <view
  3. class="{{classPrefix}}__input-box {{prefix}}-{{localValue.focus ? 'is-focused' : 'not-focused'}} {{classPrefix}}__input-box--{{center ? 'center' : ''}} {{classPrefix}}__input-box--{{shape}} {{prefix}}-class-input-container"
  4. >
  5. <view wx:if="{{label}}" class="{{classPrefix}}__label {{prefix}}-class-label">{{label}}</view>
  6. <slot wx:else name="label" />
  7. <t-icon wx:if="{{leftIcon}}" name="{{leftIcon}}" size="20px" class="{{prefix}}-icon {{prefix}}-class-left" />
  8. <slot wx:else name="left-icon" />
  9. <input
  10. type="text"
  11. name="input"
  12. disabled="{{disabled}}"
  13. class="{{prefix}}-input__keyword {{prefix}}-class-input"
  14. focus="{{localValue.focus}}"
  15. value="{{value}}"
  16. confirm-type="search"
  17. placeholder="{{placeholder}}"
  18. placeholder-class="{{classPrefix}}__placeholder {{classPrefix}}__placeholder--{{center ? 'center': 'normal'}}"
  19. bind:input="onInput"
  20. bind:focus="onFocus"
  21. bind:blur="onBlur"
  22. bind:confirm="onConfirm"
  23. />
  24. <view wx:if="{{value !==''}}" class="{{classPrefix}}__right {{prefix}}-class-right" bind:tap="handleClear">
  25. <t-icon
  26. wx:if="{{rightIcon}}"
  27. name="{{rightIcon}}"
  28. class="{{prefix}}-icon"
  29. size="18px"
  30. color="rgba(187,187,187,1)"
  31. />
  32. <slot wx:else name="right-icon" />
  33. </view>
  34. </view>
  35. <view wx:if="{{action}}" class="{{classPrefix}}__search-action {{prefix}}-class-cancel" bindtap="onActionClick">
  36. {{action}}
  37. </view>
  38. <slot wx:else name="action-text" />
  39. </view>