From 7653610c7bc45e97cb744994835cf7fb5074ff7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=96=87=E5=BD=AC?= Date: Thu, 8 Oct 2020 15:18:01 +0800 Subject: [PATCH] fix: fix the problem of page blank caused by page refresh --- src/layouts/default/LayoutContent.tsx | 8 +--- src/layouts/page/index.tsx | 56 +++++++++++++----------- src/router/routes/modules/demo/iframe.ts | 2 + yarn.lock | 23 +--------- 4 files changed, 35 insertions(+), 54 deletions(-) diff --git a/src/layouts/default/LayoutContent.tsx b/src/layouts/default/LayoutContent.tsx index 3bfb3344c11..21d65df876d 100644 --- a/src/layouts/default/LayoutContent.tsx +++ b/src/layouts/default/LayoutContent.tsx @@ -6,23 +6,17 @@ import { ContentEnum } from '/@/enums/appEnum'; import { appStore } from '/@/store/modules/app'; // import { RouterView } from 'vue-router'; import PageLayout from '/@/layouts/page/index'; -import FrameLayout from '/@/layouts/iframe/index.vue'; - -import { useSetting } from '/@/hooks/core/useSetting'; export default defineComponent({ name: 'DefaultLayoutContent', setup() { - const { projectSetting } = useSetting(); - return () => { const { getProjectConfig } = appStore; const { contentMode } = getProjectConfig; - const wrapClass = contentMode === ContentEnum.FULL ? 'full' : 'fixed'; return ( {{ - default: () => [, projectSetting.canEmbedIFramePage && ], + default: () => , }} ); diff --git a/src/layouts/page/index.tsx b/src/layouts/page/index.tsx index 096aa280c73..1ba28a69533 100644 --- a/src/layouts/page/index.tsx +++ b/src/layouts/page/index.tsx @@ -6,7 +6,9 @@ import { useTransition } from './useTransition'; import { RouterView, RouteLocation } from 'vue-router'; import { tabStore } from '/@/store/modules/tab'; +import FrameLayout from '/@/layouts/iframe/index.vue'; +import { useSetting } from '/@/hooks/core/useSetting'; // import { useRouter } from 'vue-router'; export default defineComponent({ name: 'PageLayout', @@ -22,6 +24,7 @@ export default defineComponent({ const { on: transitionOn } = useTransition(); on = transitionOn; } + const { projectSetting } = useSetting(); return () => { const { routerTransition, @@ -32,32 +35,35 @@ export default defineComponent({ const openCache = openKeepAlive && show; const cacheTabs = toRaw(tabStore.getKeepAliveTabsState) as string[]; - return [ - - {{ - default: ({ Component, route }: { Component: any; route: RouteLocation }) => { - const Content = openCache ? ( - + return ( +
+ + {{ + default: ({ Component, route }: { Component: any; route: RouteLocation }) => { + const Content = openCache ? ( + + + + ) : ( - - ) : ( - - ); - return openRouterTransition ? ( - - {() => Content} - - ) : ( - Content - ); - }, - }} - , - ]; + ); + return openRouterTransition ? ( + + {() => Content} + + ) : ( + Content + ); + }, + }} + + {projectSetting.canEmbedIFramePage && } +
+ ); }; }, }); diff --git a/src/router/routes/modules/demo/iframe.ts b/src/router/routes/modules/demo/iframe.ts index 461da45b1f3..7d67e2fa4d5 100644 --- a/src/router/routes/modules/demo/iframe.ts +++ b/src/router/routes/modules/demo/iframe.ts @@ -23,6 +23,7 @@ export default { meta: { frameSrc: 'https://2x.antdv.com/docs/vue/introduce-cn/', title: 'antVue文档(内嵌)', + afterCloseLoading: true, }, }, { @@ -32,6 +33,7 @@ export default { meta: { frameSrc: 'https://vvbin.cn/docs/', title: '项目文档(内嵌)', + afterCloseLoading: true, }, }, { diff --git a/yarn.lock b/yarn.lock index 974fd9d3c58..c6d2c6591d5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1601,7 +1601,7 @@ cli-cursor@^3.1.0: dependencies: restore-cursor "^3.1.0" -cli-spinners@^2.2.0, cli-spinners@^2.4.0: +cli-spinners@^2.2.0: version "2.4.0" resolved "https://registry.npm.taobao.org/cli-spinners/download/cli-spinners-2.4.0.tgz?cache=0&sync_timestamp=1595080377121&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcli-spinners%2Fdownload%2Fcli-spinners-2.4.0.tgz#c6256db216b878cfba4720e719cec7cf72685d7f" integrity sha1-xiVtsha4eM+6RyDnGc7Hz3JoXX8= @@ -4821,20 +4821,6 @@ ora@^4.0.4: strip-ansi "^6.0.0" wcwidth "^1.0.1" -ora@^5.1.0: - version "5.1.0" - resolved "https://registry.npm.taobao.org/ora/download/ora-5.1.0.tgz?cache=0&sync_timestamp=1599424857800&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fora%2Fdownload%2Fora-5.1.0.tgz#b188cf8cd2d4d9b13fd25383bc3e5cba352c94f8" - integrity sha1-sYjPjNLU2bE/0lODvD5cujUslPg= - dependencies: - chalk "^4.1.0" - cli-cursor "^3.1.0" - cli-spinners "^2.4.0" - is-interactive "^1.0.0" - log-symbols "^4.0.0" - mute-stream "0.0.8" - strip-ansi "^6.0.0" - wcwidth "^1.0.1" - os-tmpdir@~1.0.2: version "1.0.2" resolved "https://registry.npm.taobao.org/os-tmpdir/download/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" @@ -6935,13 +6921,6 @@ vfile@^4.0.0: unist-util-stringify-position "^2.0.0" vfile-message "^2.0.0" -vite-jsx@^1.0.5: - version "1.0.6" - resolved "https://registry.npm.taobao.org/vite-jsx/download/vite-jsx-1.0.6.tgz#5c33b9da6a6562d041418005370a7e3043b0e70c" - integrity sha1-XDO52mplYtBBQYAFNwp+MEOw5ww= - dependencies: - magic-string "^0.25.7" - vite-plugin-mock@^1.0.2: version "1.0.2" resolved "https://registry.npm.taobao.org/vite-plugin-mock/download/vite-plugin-mock-1.0.2.tgz#07bdd67a8006fd60a6a83198479f3c0c57c7df53"