search.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <div class="search d-flex align-center">
  3. <div style="position: relative;">
  4. <div class="jobBox d-flex pl-5" :class="{'drawer': drawer}" @click.stop="drawer = !drawer">
  5. <span>职位类型</span>
  6. <span class="mdi mdi-chevron-down px-2" style="font-size: 18px;"></span>
  7. </div>
  8. <jobTypeCard class="jobTypeCardBox" v-if="drawer" float @click.stop=""></jobTypeCard>
  9. </div>
  10. <v-text-field
  11. v-model="value"
  12. placeholder="搜索职位/公司"
  13. color="primary"
  14. variant="plain"
  15. density="compact"
  16. :hide-details="true"
  17. class="px-2"
  18. style="height: 100%; line-height: 100%;"
  19. ></v-text-field>
  20. <div class="searchBtn">搜索</div>
  21. </div>
  22. </template>
  23. <script setup>
  24. import { useSharedState } from '@/store/sharedState'
  25. import jobTypeCard from './jobTypeCard.vue'
  26. import { ref, watch } from 'vue';
  27. defineOptions({ name:'personal-search'})
  28. const value = ref('')
  29. let drawer = ref(false)
  30. // 点击外部关闭职位下拉
  31. const sharedState = useSharedState()
  32. // 监听 layoutClickCount 变化
  33. watch(() => sharedState.layoutClickCount, () => {
  34. // console.log('layoutClickCount', newValue)
  35. if (drawer.value) drawer.value = false
  36. });
  37. </script>
  38. <style lang="scss" scoped>
  39. .search {
  40. height: 50px;
  41. width: 800px;
  42. margin: 20px auto;
  43. border: 2px solid var(--v-primary-base);
  44. border-radius: 5px;
  45. .jobBox {
  46. cursor: pointer;
  47. &:hover {
  48. color: var(--v-primary-base);
  49. }
  50. }
  51. .drawer {
  52. color: var(--v-primary-base);
  53. }
  54. .searchBtn {
  55. width: 100px;
  56. height: 50px; line-height: 48px;
  57. text-align: center;
  58. font-size: 18px;
  59. color: #fff;
  60. background-color: var(--v-primary-base);
  61. }
  62. .jobTypeCardBox {
  63. position: absolute;
  64. top: 42px;
  65. left: 0;
  66. }
  67. }
  68. </style>