My_search.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <view class="My_search">
  3. <slot></slot>
  4. <u-search v-model="value" :showAction="false" @search="onSearch" @custom="onSearch" @clear="onSearch"
  5. :placeholder="placeholder" />
  6. <view v-if="isFilter" @click="onFilter" class="filtrate" hover-class="navigator-hover">
  7. <text class="iconfont icon-shaixuan" />筛选
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. name: 'My_search',
  14. props: {
  15. placeholder: {
  16. type: String,
  17. default: "请输入关键字"
  18. },
  19. isFilter: {
  20. type: Boolean,
  21. default: true
  22. },
  23. startSearch: Function,
  24. openFilter: Function,
  25. },
  26. data() {
  27. return {
  28. value: ""
  29. };
  30. },
  31. methods: {
  32. onSearch(value) {
  33. this.$emit("startSearch", value)
  34. },
  35. onFilter() {
  36. this.$emit("openFilter")
  37. }
  38. },
  39. }
  40. </script>
  41. <style lang="scss" scoped>
  42. .My_search {
  43. display: flex;
  44. align-items: center;
  45. width: 100vw;
  46. height: 45px;
  47. padding: 8px 10px;
  48. background: #052E5D;
  49. box-sizing: border-box;
  50. .filtrate {
  51. height: 30px;
  52. line-height: 30px;
  53. text-align: center;
  54. margin-left: 5px;
  55. font-size: 14px;
  56. color: #FFFFFF;
  57. border-radius: 4px;
  58. .iconfont {
  59. margin-right: 3px;
  60. font-size: 14px;
  61. }
  62. }
  63. /deep/ .u-search .u-search__content {
  64. height: 29px !important;
  65. }
  66. /deep/ .u-icon__icon {
  67. font-size: 22px !important;
  68. line-height: 22px !important;
  69. }
  70. }
  71. </style>