瀏覽代碼

perf: 优化`iframe`缓存 (#879)

otis 1 年之前
父節點
當前提交
c5e280307e
共有 1 個文件被更改,包括 8 次插入5 次删除
  1. 8 5
      src/layout/frameView.vue

+ 8 - 5
src/layout/frameView.vue

@@ -48,14 +48,17 @@ function init() {
 watch(
   () => currentRoute.fullPath,
   path => {
+    if (
+      currentRoute.name === "Redirect" &&
+      path.includes(props.frameInfo?.fullPath)
+    ) {
+      frameSrc.value = path; // redirect时,置换成任意值,待重定向后 重新赋值
+      loading.value = true;
+    }
+    // 重新赋值
     if (props.frameInfo?.fullPath === path) {
       frameSrc.value = props.frameInfo?.frameSrc;
     }
-    // 重新加载
-    if (path.indexOf("/redirect/") > -1) {
-      frameSrc.value = props.frameInfo?.fullPath;
-      loading.value = true;
-    }
   }
 );