Skip to content

Commit aada21b

Browse files
committed
perf: 优化 pinia store 调用位置
1 parent 8dec01f commit aada21b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/router/permission.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { setRouteChange } from "@/composables/useRouteListener"
22
import { useTitle } from "@/composables/useTitle"
33
import routeSettings from "@/config/route"
44
import isWhiteList from "@/config/white-list"
5-
import { usePermissionStoreOutside } from "@/pinia/stores/permission"
6-
import { useUserStoreOutside } from "@/pinia/stores/user"
5+
import { usePermissionStore } from "@/pinia/stores/permission"
6+
import { useUserStore } from "@/pinia/stores/user"
77
import { router } from "@/router"
88
import { getToken } from "@/utils/cache/cookies"
99
import { ElMessage } from "element-plus"
@@ -12,11 +12,11 @@ import "nprogress/nprogress.css"
1212

1313
NProgress.configure({ showSpinner: false })
1414
const { setTitle } = useTitle()
15-
const userStore = useUserStoreOutside()
16-
const permissionStore = usePermissionStoreOutside()
1715

1816
router.beforeEach(async (to, _from, next) => {
1917
NProgress.start()
18+
const userStore = useUserStore()
19+
const permissionStore = usePermissionStore()
2020
// 如果没有登陆
2121
if (!getToken()) {
2222
// 如果在免登录的白名单中,则直接进入

0 commit comments

Comments
 (0)