AppMain.vue 1.9 KB

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