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.

67 lines
1.2 KiB

4 months ago
  1. <template>
  2. <view class="searchBg">
  3. <view class="flex">
  4. <view class="searchIcon">
  5. <image src="@/static/images/searchIcon.png" mode=""></image>
  6. </view>
  7. <view class="inputBox">
  8. <u-search :placeholder="placeholder" searchIcon=" " v-model="keyword" :color="'#333'" :disabled="disable" placeholderColor="#9C9C9C" style="pointer-events: none;" :bgColor="'transparent'" @change="$u.debounce(searchFn, 1500)" :showAction="false" @search="$u.debounce(searchFn, 500)" @clear="clearSearchFn"></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. }
  20. },
  21. methods: {
  22. searchFn() {
  23. this.$emit('searchFn', this.keyword)
  24. },
  25. clearSearchFn() {
  26. this.keyword = ''
  27. }
  28. }
  29. }
  30. </script>
  31. <style lang="scss" scoped>
  32. image {
  33. display: block;
  34. width: 100%;
  35. height: 100%;
  36. }
  37. .searchBg {
  38. background: #EFEFEF;
  39. width: 100%;
  40. height: 72rpx;
  41. border-radius: 10rpx;
  42. line-height: 72rpx;
  43. .flex {
  44. height: 100%;
  45. padding: 0 28rpx;
  46. .searchIcon {
  47. width: 32rpx;
  48. height: 32rpx;
  49. }
  50. .inputBox {
  51. flex: 1;
  52. color: #333;
  53. font-size: 28rpx;
  54. margin-left: -16rpx;
  55. }
  56. }
  57. }
  58. </style>