AppMain.vue 1.9 KB

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