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

90 lines
1.7 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
3 weeks ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
  1. <template>
  2. <view class="searchBg" :style="{background: `${bg}`}">
  3. <view class="flex">
  4. <view class="searchIcon">
  5. <image src="@/static/images/icon/searchIcon.png" mode=""></image>
  6. </view>
  7. <view class="inputBox">
  8. <view class="isDisable" v-if="disable" @click="searchFn">{{ placeholder }}</view>
  9. <u-search v-else :placeholder="placeholder" v-model="keyword" :color="'#333'" placeholderColor="#CCCCCC" @click="searchFn" :bgColor="'transparent'" @change="$u.debounce(searchFn, 1500)" :showAction="false" @search="$u.debounce(searchFn, 500)" @clear="clearSearchFn"></u-search>
  10. </view>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. export default {
  16. // props: ['placeholder', 'disable', 'bg'],
  17. props: {
  18. placeholder: {
  19. type: String,
  20. default: ''
  21. },
  22. disable: {
  23. type: Boolean,
  24. default: false
  25. },
  26. bg: {
  27. type: String,
  28. default: '#fff'
  29. }
  30. },
  31. data() {
  32. return {
  33. keyword: ''
  34. }
  35. },
  36. methods: {
  37. searchFn() {
  38. this.$emit('searchFn', this.keyword)
  39. },
  40. clearSearchFn() {
  41. this.keyword = ''
  42. }
  43. }
  44. }
  45. </script>
  46. <style lang="scss" scoped>
  47. .searchBg {
  48. width: 100%;
  49. height: 72rpx;
  50. border-radius: 16rpx;
  51. line-height: 72rpx;
  52. .flex {
  53. height: 100%;
  54. padding: 0 28rpx 0 0;
  55. .searchIcon {
  56. width: 52rpx;
  57. height: 52rpx;
  58. margin: 0 -24rpx 0 12rpx;
  59. }
  60. .inputBox {
  61. flex: 1;
  62. color: #fff;
  63. font-size: 24rpx;
  64. }
  65. }
  66. }
  67. .textColor {
  68. font-size: 26rpx;
  69. color: #fff;
  70. line-height: 72rpx;
  71. padding-left: 14rpx;
  72. }
  73. .isDisable {
  74. height: 62rpx;
  75. background: #FFFFFF;
  76. border-radius: 20px;
  77. font-size: 28rpx;
  78. color: #ccc;
  79. line-height: 62rpx;
  80. padding-left: 40rpx;
  81. }
  82. </style>