You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.2 KiB

9 months ago
  1. <template>
  2. <view class="searchBg">
  3. <view class="flex">
  4. <view class="searchIcon">
  5. <image src="@/static/images/index/searchIcon.png" mode=""></image>
  6. </view>
  7. <view class="inputBox">
  8. <u-search :placeholder="placeholder" v-model="keyword" :color="'#fff'" :disabled="disable" placeholderColor="#fff" :class="{disableClass: disable}" :bgColor="'transparent'" :showAction="false" @change="$u.debounce(searchFn, 1200)" @search="$u.debounce(searchFn, 500)" :clearabled="true"></u-search>
  9. </view>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. export default {
  15. props: ['placeholder', 'disable'],
  16. data() {
  17. return {
  18. keyword: '',
  19. changeOk: true
  20. }
  21. },
  22. methods: {
  23. searchFn() {
  24. this.$emit('searchFn', this.keyword)
  25. },
  26. }
  27. }
  28. </script>
  29. <style lang="scss" scoped>
  30. .searchBg {
  31. background: #8ABAED;
  32. width: 100%;
  33. height: 72rpx;
  34. border-radius: 16rpx;
  35. line-height: 72rpx;
  36. .flex {
  37. height: 100%;
  38. padding: 0 28rpx;
  39. .searchIcon {
  40. width: 40rpx;
  41. height: 40rpx;
  42. }
  43. .inputBox {
  44. flex: 1;
  45. color: #fff;
  46. font-size: 28rpx;
  47. .disableClass {
  48. pointer-events: none;
  49. }
  50. }
  51. }
  52. }
  53. </style>