学员端小程序
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.

66 lines
1.2 KiB

11 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" :bgColor="'transparent'" @change="$u.debounce(searchFn, 2000)" :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. this.$emit('searchFn', '')
  28. }
  29. }
  30. }
  31. </script>
  32. <style lang="scss" scoped>
  33. .searchBg {
  34. background: #8ABAED;
  35. width: 100%;
  36. height: 72rpx;
  37. border-radius: 16rpx;
  38. line-height: 72rpx;
  39. .flex {
  40. height: 100%;
  41. padding: 0 28rpx;
  42. .searchIcon {
  43. width: 40rpx;
  44. height: 40rpx;
  45. }
  46. .inputBox {
  47. flex: 1;
  48. color: #fff;
  49. font-size: 28rpx;
  50. }
  51. }
  52. }
  53. .textColor {
  54. font-size: 26rpx;
  55. color: #fff;
  56. line-height: 72rpx;
  57. padding-left: 14rpx;
  58. }
  59. </style>