AppMain.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <section class="app-main">
  3. <router-view v-slot="{ Component, route }">
  4. <transition :enter-active-class="animante" mode="out-in">
  5. <div>
  6. <keep-alive v-if="!route.meta.noCache" :include="tagsViewStore.cachedViews">
  7. <component :is="Component" v-if="!route.meta.link" :key="route.path" />
  8. </keep-alive>
  9. <component :is="Component" v-if="!route.meta.link && route.meta.noCache" :key="route.path" />
  10. </div>
  11. </transition>
  12. </router-view>
  13. <iframe-toggle />
  14. </section>
  15. </template>
  16. <script setup name="AppMain" lang="ts">
  17. import useSettingsStore from '@/store/modules/settings';
  18. import useTagsViewStore from '@/store/modules/tagsView';
  19. import IframeToggle from './IframeToggle/index.vue';
  20. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  21. const tagsViewStore = useTagsViewStore();
  22. // 随机动画集合
  23. const animante = ref<string>('');
  24. const animationEnable = ref(useSettingsStore().animationEnable);
  25. watch(
  26. () => useSettingsStore().animationEnable,
  27. (val: boolean) => {
  28. animationEnable.value = val;
  29. if (val) {
  30. animante.value = proxy?.animate.animateList[Math.round(Math.random() * proxy?.animate.animateList.length)] as string;
  31. } else {
  32. animante.value = proxy?.animate.defaultAnimate as string;
  33. }
  34. },
  35. { immediate: true }
  36. );
  37. </script>
  38. <style lang="scss" scoped>
  39. .app-main {
  40. /* 50= navbar 50 */
  41. min-height: calc(100vh - 50px);
  42. width: 100%;
  43. position: relative;
  44. overflow: hidden;
  45. }
  46. .fixed-header + .app-main {
  47. padding-top: 50px;
  48. }
  49. .hasTagsView {
  50. .app-main {
  51. /* 84 = navbar + tags-view = 50 + 34 */
  52. min-height: calc(100vh - 84px);
  53. }
  54. .fixed-header + .app-main {
  55. padding-top: 84px;
  56. }
  57. }
  58. </style>
  59. <style lang="scss">
  60. // fix css style bug in open el-dialog
  61. .el-popup-parent--hidden {
  62. .fixed-header {
  63. padding-right: 6px;
  64. }
  65. }
  66. ::-webkit-scrollbar {
  67. width: 6px;
  68. height: 6px;
  69. }
  70. ::-webkit-scrollbar-track {
  71. background-color: #f1f1f1;
  72. }
  73. ::-webkit-scrollbar-thumb {
  74. background-color: #c0c0c0;
  75. border-radius: 3px;
  76. }
  77. </style>