From 6eaaba9e9249bf390117171c8ddbb3ab4f8f417c Mon Sep 17 00:00:00 2001 From: valarchie <343928303@qq.com> Date: Tue, 18 Jul 2023 15:06:18 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E7=9B=91=E6=8E=A7=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/frameView.vue | 5 +++++ types/router.d.ts | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/layout/frameView.vue b/src/layout/frameView.vue index c9ae808..ee7e700 100644 --- a/src/layout/frameView.vue +++ b/src/layout/frameView.vue @@ -10,9 +10,14 @@ const loading = ref(true); const currentRoute = useRoute(); const frameSrc = ref(""); const frameRef = ref(null); +const { VITE_APP_BASE_API } = import.meta.env; if (unref(currentRoute.meta)?.frameSrc) { frameSrc.value = unref(currentRoute.meta)?.frameSrc as string; + // 如果是内部链接的话, 需要加上后端服务器地址前缀 + if (unref(currentRoute.meta).isFrameSrcInternal) { + frameSrc.value = `${VITE_APP_BASE_API}${frameSrc.value}`; + } } unref(currentRoute.meta)?.frameLoading === false && hideLoading(); diff --git a/types/router.d.ts b/types/router.d.ts index 6f6880a..718177a 100644 --- a/types/router.d.ts +++ b/types/router.d.ts @@ -29,6 +29,10 @@ declare global { keepAlive?: boolean; /** 内嵌的`iframe`链接 `可选` */ frameSrc?: string; + /** 是否是内部页面 使用frameSrc来嵌入页面时,当isFrameSrcInternal=true的时候, 前端需要做特殊处理 */ + /** 比如链接是 /druid/login.html */ + /** 前端需要处理成 http://localhost:8080/druid/login.html */ + isFrameSrcInternal?: boolean; /** `iframe`页是否开启首次加载动画(默认`true`)`可选` */ frameLoading?: boolean; /** 页面加载动画(有两种形式,一种直接采用vue内置的`transitions`动画,另一种是使用`animate.css`写进、离场动画)`可选` */