search.vue 725 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <template>
  2. <view>
  3. <u-search placeholder="搜索人脉、联络记录、人脉指南" :show-action="!global" v-model="key"
  4. :disabled="global" @click="cLick" @custom="search" @search="search"/>
  5. </view>
  6. </template>
  7. <script>
  8. export default {
  9. props: {
  10. global: {//是否全局搜索
  11. type: Boolean,
  12. default: false,
  13. },
  14. searchKey: {//搜索条件
  15. type: String,
  16. default: '',
  17. },
  18. },
  19. data() {
  20. return {
  21. key: this.searchKey
  22. }
  23. },
  24. methods: {
  25. cLick() {
  26. if (this.global) {
  27. uni.navigateTo({
  28. url: '/pages/home/search',
  29. })
  30. }
  31. },
  32. search() {
  33. if (!this.global) {
  34. this.$emit('update:searchKey', this.key)
  35. this.$emit('search', this.key)
  36. }
  37. },
  38. },
  39. }
  40. </script>
  41. <style>
  42. </style>