AppMain.vue 1.8 KB

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