From 8c7f4184a1395a6e53a6e8e1dc36d14819e47ab4 Mon Sep 17 00:00:00 2001 From: pany <939630029@qq.com> Date: Tue, 6 Feb 2024 17:07:07 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E6=96=B0=E7=89=88=20vue=20=E5=B7=B2?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=83=AD=E6=9B=B4=E6=96=B0=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E7=9A=84=E9=A1=B5=E9=9D=A2=E7=99=BD=E5=B1=8F=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=8C=E9=A1=B9=E7=9B=AE=E7=A7=BB=E9=99=A4=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/permission.ts | 2 -- src/store/modules/tags-view.ts | 6 ------ src/utils/fix-blank-page.ts | 15 --------------- 3 files changed, 23 deletions(-) delete mode 100644 src/utils/fix-blank-page.ts diff --git a/src/router/permission.ts b/src/router/permission.ts index 1cf2c2a..880dc0a 100644 --- a/src/router/permission.ts +++ b/src/router/permission.ts @@ -5,7 +5,6 @@ import { ElMessage } from "element-plus" import { setRouteChange } from "@/hooks/useRouteListener" import { useTitle } from "@/hooks/useTitle" import { getToken } from "@/utils/cache/cookies" -import { fixBlankPage } from "@/utils/fix-blank-page" import routeSettings from "@/config/route" import isWhiteList from "@/config/white-list" import NProgress from "nprogress" @@ -15,7 +14,6 @@ const { setTitle } = useTitle() NProgress.configure({ showSpinner: false }) router.beforeEach(async (to, _from, next) => { - fixBlankPage() NProgress.start() const userStore = useUserStoreHook() const permissionStore = usePermissionStoreHook() diff --git a/src/store/modules/tags-view.ts b/src/store/modules/tags-view.ts index 63aa7cb..51194de 100644 --- a/src/store/modules/tags-view.ts +++ b/src/store/modules/tags-view.ts @@ -1,5 +1,4 @@ import { ref, watchEffect } from "vue" -import store from "@/store" import { defineStore } from "pinia" import { useSettingsStore } from "./settings" import { type RouteLocationNormalized } from "vue-router" @@ -94,8 +93,3 @@ export const useTagsViewStore = defineStore("tags-view", () => { delAllCachedViews } }) - -/** 在 setup 外使用 */ -export function useTagsViewStoreHook() { - return useTagsViewStore(store) -} diff --git a/src/utils/fix-blank-page.ts b/src/utils/fix-blank-page.ts deleted file mode 100644 index bff0667..0000000 --- a/src/utils/fix-blank-page.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { useTagsViewStoreHook } from "@/store/modules/tags-view" - -/** - * 功能:修复 组合使用导致的页面空白 - * 原因:似乎是 Vue 本身的 BUG:https://github.com/vuejs/core/issues/7121 - * 复现:在不使用该函数的情况下,可以通过如下步骤复现: - * 1. 进入一个页面 - * 2. 修改该页面的 TS 代码并保存 - * 3. 回到浏览器切换一下页面 - * 4. 结果:内容区没有加载出来呈现空白状态 - */ -export const fixBlankPage = () => { - const tagsViewStore = useTagsViewStoreHook() - tagsViewStore.cachedViews = [...tagsViewStore.cachedViews] -}