洛阳学员端
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.

78 lines
1.4 KiB

8 months ago
8 months ago
8 months ago
  1. <template>
  2. <view class="searchBg" :style="{background: `${bg}`}">
  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" 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', 'bg'],
  16. props: {
  17. placeholder: {
  18. type: String,
  19. default: ''
  20. },
  21. disable: {
  22. type: Boolean,
  23. default: false
  24. },
  25. bg: {
  26. type: String,
  27. default: '#ddd'
  28. }
  29. },
  30. data() {
  31. return {
  32. keyword: ''
  33. }
  34. },
  35. methods: {
  36. searchFn() {
  37. this.$emit('searchFn', this.keyword)
  38. },
  39. clearSearchFn() {
  40. this.keyword = ''
  41. }
  42. }
  43. }
  44. </script>
  45. <style lang="scss" scoped>
  46. .searchBg {
  47. width: 100%;
  48. height: 72rpx;
  49. border-radius: 16rpx;
  50. line-height: 72rpx;
  51. .flex {
  52. height: 100%;
  53. padding: 0 28rpx;
  54. .searchIcon {
  55. width: 40rpx;
  56. height: 40rpx;
  57. }
  58. .inputBox {
  59. flex: 1;
  60. color: #fff;
  61. font-size: 28rpx;
  62. }
  63. }
  64. }
  65. .textColor {
  66. font-size: 26rpx;
  67. color: #fff;
  68. line-height: 72rpx;
  69. padding-left: 14rpx;
  70. }
  71. </style>