index.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <div class="parent" @click="layoutClick">
  3. <NavBar class="headers"></NavBar>
  4. <div class="content">
  5. <router-view></router-view>
  6. <!-- <router-view v-slot="{ Component }">
  7. <keep-alive>
  8. <component :is="Component" :key="router.currentRoute.value.path" v-if="router.currentRoute.value.meta?.keepAlive"/>
  9. </keep-alive>
  10. <component :is="Component" :key="router.currentRoute.value.path" v-if="!router.currentRoute.value.meta?.keepAlive"/>
  11. </router-view> -->
  12. </div>
  13. <Footers v-if="footerWhiteList.indexOf(router.currentRoute.value.path) === -1" class="mt-10"></Footers>
  14. <Slider v-if="whiteList.indexOf(router.currentRoute.value.path) === -1" class="slider"></Slider>
  15. </div>
  16. </template>
  17. <script setup>
  18. import NavBar from './personal/navBar.vue'
  19. import Footers from './personal/footer.vue'
  20. import Slider from './personal/slider.vue'
  21. import { useSharedState } from '@/store/sharedState'
  22. import { useRouter } from 'vue-router'
  23. defineOptions({ name: 'personal-layout-index' })
  24. // 不展示侧边栏名单
  25. const whiteList = ['/login', '/privacyPolicy', '/userAgreement', '/register', '/recruit/personal/advertisement/introduce']
  26. const footerWhiteList = ['/recruit/personal/message', '/recruit/personal/advertisement/introduce', '/about', '/headhunting', '/headhunting/service', '/headhunting/service/details']
  27. const router = useRouter()
  28. const sharedState = useSharedState()
  29. const layoutClick = () => {
  30. sharedState.increment()
  31. }
  32. </script>
  33. <style lang="scss" scoped>
  34. .parent {
  35. background-color: var(--default-bgc);
  36. position: relative;
  37. }
  38. .headers {
  39. position: fixed;
  40. right: 0;
  41. left: 0;
  42. top: 0;
  43. z-index: 999;
  44. }
  45. .slider {
  46. position: fixed;
  47. bottom: 50%;
  48. right: 24px;
  49. translate: 0 50%;
  50. z-index: 999;
  51. }
  52. .content {
  53. min-height: calc(100vh - (48px + 225px));
  54. margin-top: 50px;
  55. }
  56. </style>