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

68 lines
1.3 KiB

  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" v-if="disable">
  8. <view class="textColor">{{ placeholder }}</view>
  9. </view>
  10. <view class="inputBox" v-else>
  11. <u-search :placeholder="placeholder" v-model="keyword" :color="'#fff'" placeholderColor="#fff" :bgColor="'transparent'" :showAction="false" @search="$u.debounce(searchFn, 500)" @clear="clearSearchFn"></u-search>
  12. </view>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. export default {
  18. props: ['placeholder', 'disable'],
  19. data() {
  20. return {
  21. keyword: ''
  22. }
  23. },
  24. methods: {
  25. searchFn() {
  26. this.$emit('searchFn', this.keyword)
  27. },
  28. clearSearchFn() {
  29. this.keyword = ''
  30. this.$emit('searchFn', '')
  31. }
  32. }
  33. }
  34. </script>
  35. <style lang="scss" scoped>
  36. .searchBg {
  37. background: #8ABAED;
  38. width: 100%;
  39. height: 72rpx;
  40. border-radius: 16rpx;
  41. line-height: 72rpx;
  42. .flex {
  43. height: 100%;
  44. padding: 0 28rpx;
  45. .searchIcon {
  46. width: 40rpx;
  47. height: 40rpx;
  48. }
  49. .inputBox {
  50. flex: 1;
  51. color: #fff;
  52. font-size: 28rpx;
  53. }
  54. }
  55. }
  56. .textColor {
  57. font-size: 26rpx;
  58. color: #fff;
  59. line-height: 72rpx;
  60. padding-left: 14rpx;
  61. }
  62. </style>