AppMain.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <section class="app-main">
  3. <router-view v-slot="{ Component, route }">
  4. <transition name="fade-transform" mode="out-in">
  5. <keep-alive :include="cachedViews">
  6. <component :is="Component" :key="route.path"/>
  7. </keep-alive>
  8. </transition>
  9. </router-view>
  10. </section>
  11. </template>
  12. <script setup>
  13. let store = useStore()
  14. const route = useRoute()
  15. store.dispatch('tagsView/addCachedView', route)
  16. const cachedViews = computed(() => {
  17. return store.state.tagsView.cachedViews
  18. })
  19. </script>
  20. <style lang="scss" scoped>
  21. .app-main {
  22. /* 50= navbar 50 */
  23. min-height: calc(100vh - 50px);
  24. width: 100%;
  25. position: relative;
  26. overflow: hidden;
  27. }
  28. .fixed-header + .app-main {
  29. padding-top: 50px;
  30. }
  31. .hasTagsView {
  32. .app-main {
  33. /* 84 = navbar + tags-view = 50 + 34 */
  34. min-height: calc(100vh - 84px);
  35. }
  36. .fixed-header + .app-main {
  37. padding-top: 84px;
  38. }
  39. }
  40. </style>
  41. <style lang="scss">
  42. // fix css style bug in open el-dialog
  43. .el-popup-parent--hidden {
  44. .fixed-header {
  45. padding-right: 17px;
  46. }
  47. }
  48. </style>