fix: 三级路由无法缓存BUG

master
李小林 9 months ago
parent 7836c41392
commit f3a6711fe6
  1. 37
      index.html
  2. 10
      src/plugins/permission.ts
  3. 5
      src/views/family/operate/index.vue

@ -31,31 +31,26 @@
} }
.loader { .loader {
position: relative; --d: 22px;
width: 40px;
aspect-ratio: 0.577;
overflow: hidden;
clip-path: polygon(0 0, 100% 100%, 0 100%, 100% 0);
animation: l19 2s infinite linear;
}
.loader::before { width: 4px;
position: absolute; height: 4px;
inset: -150%; color: #25b09b;
content: ""; border-radius: 50%;
background: repeating-conic-gradient( box-shadow:
from 30deg, calc(1 * var(--d)) calc(0 * var(--d)) 0 0,
#ffabab 0 60deg, calc(0.707 * var(--d)) calc(0.707 * var(--d)) 0 1px,
#abe4ff 0 120deg, calc(0 * var(--d)) calc(1 * var(--d)) 0 2px,
#ff7373 0 180deg calc(-0.707 * var(--d)) calc(0.707 * var(--d)) 0 3px,
); calc(-1 * var(--d)) calc(0 * var(--d)) 0 4px,
animation: inherit; calc(-0.707 * var(--d)) calc(-0.707 * var(--d)) 0 5px,
animation-direction: reverse; calc(0 * var(--d)) calc(-1 * var(--d)) 0 6px;
animation: l27 1s infinite steps(8);
} }
@keyframes l19 { @keyframes l27 {
100% { 100% {
transform: rotate(360deg); transform: rotate(1turn);
} }
} }
</style> </style>

@ -16,6 +16,16 @@ export function setupPermission() {
next({ path: "/" }); next({ path: "/" });
NProgress.done(); NProgress.done();
} else { } else {
//处理三级目录页面无法缓存BUG
if (to.matched && to.matched.length > 2) {
for (let i = 0; i < to.matched.length; i++) {
const element = to.matched[i];
if (element.name === "Operate") {
to.matched.splice(i, 1);
}
}
}
const userStore = useUserStore(); const userStore = useUserStore();
const hasRoles = const hasRoles =
userStore.user.roles && userStore.user.roles.length > 0; userStore.user.roles && userStore.user.roles.length > 0;

@ -15,6 +15,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { useTagsViewStore } from "@/store"; import { useTagsViewStore } from "@/store";
defineOptions({
name: "Operate",
inheritAttrs: false,
});
const cachedViews = computed(() => useTagsViewStore().cachedViews); // const cachedViews = computed(() => useTagsViewStore().cachedViews); //
</script> </script>

Loading…
Cancel
Save