v-search.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <view class="v-search">
  3. <view class="search-wrap">
  4. <up-search placeholder="搜索品种" v-model="searchVal" @clear="clear" @custom="searchFun" @search="searchFun"></up-search>
  5. </view>
  6. </view>
  7. </template>
  8. <script setup>
  9. import {
  10. ref
  11. } from "vue"
  12. const searchVal = ref('')
  13. const searchFun = (e)=>{
  14. emit('searchCallback',e)
  15. }
  16. const clear = ()=>{
  17. emit('clearCallback')
  18. }
  19. const emit = defineEmits(['searchCallback','clearCallback'])
  20. </script>
  21. <style lang="scss" scoped>
  22. .v-search {
  23. display: flex;
  24. align-items: center;
  25. width: 100%;
  26. border: 2rpx solid #FFD95E;
  27. border-radius: 40rpx;
  28. .search-wrap {
  29. flex: 1;
  30. ::v-deep {
  31. .u-search {
  32. .u-search__content {
  33. background-color: transparent !important;
  34. .u-search__content__input {
  35. background-color: transparent !important;
  36. }
  37. }
  38. .u-search__action {
  39. text-align: center;
  40. line-height: 52rpx;
  41. border-radius: 40rpx;
  42. font-size: 28rpx;
  43. background-color: #FFD95E;
  44. margin: 6rpx 8rpx;
  45. width: 112rpx;
  46. height: 52rpx;
  47. }
  48. }
  49. }
  50. }
  51. .search-btn {
  52. text-align: center;
  53. line-height: 52rpx;
  54. border-radius: 40rpx;
  55. font-size: 28rpx;
  56. background-color: #FFD95E;
  57. margin: 6rpx 8rpx;
  58. width: 112rpx;
  59. height: 52rpx;
  60. }
  61. }
  62. </style>