AppMain.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <section class="app-main">
  3. <router-view v-slot="{ Component, route }">
  4. <transition name="fade-transform" mode="out-in">
  5. <div>
  6. <keep-alive :include="tagsViewStore.cachedViews">
  7. <component v-if="!route.meta.link" :is="Component" :key="route.path"/>
  8. </keep-alive>
  9. </div>
  10. </transition>
  11. </router-view>
  12. <iframe-toggle/>
  13. </section>
  14. </template>
  15. <script setup>
  16. import useTagsViewStore from '@/store/modules/tagsView'
  17. const route = useRoute()
  18. const tagsViewStore = useTagsViewStore()
  19. onMounted(() => {
  20. addIframe()
  21. })
  22. watch((route) => {
  23. addIframe()
  24. })
  25. function addIframe() {
  26. if (route.meta.link) {
  27. useTagsViewStore().addIframeView(route)
  28. }
  29. }
  30. </script>
  31. <style lang="scss" scoped>
  32. .app-main {
  33. /* 50= navbar 50 */
  34. min-height: calc(100vh - 50px);
  35. width: 100%;
  36. position: relative;
  37. overflow: hidden;
  38. }
  39. .fixed-header + .app-main {
  40. padding-top: 50px;
  41. }
  42. .hasTagsView {
  43. .app-main {
  44. /* 84 = navbar + tags-view = 50 + 34 */
  45. min-height: calc(100vh - 84px);
  46. }
  47. .fixed-header + .app-main {
  48. padding-top: 84px;
  49. }
  50. }
  51. </style>
  52. <style lang="scss">
  53. // fix css style bug in open el-dialog
  54. .el-popup-parent--hidden {
  55. .fixed-header {
  56. padding-right: 6px;
  57. }
  58. }
  59. ::-webkit-scrollbar {
  60. width: 6px;
  61. height: 6px;
  62. }
  63. ::-webkit-scrollbar-track {
  64. background-color: #f1f1f1;
  65. }
  66. ::-webkit-scrollbar-thumb {
  67. background-color: #c0c0c0;
  68. border-radius: 3px;
  69. }
  70. </style>