Browse Source

fix: delete `isNavigating` in `configureStore`

nian 2 months ago
parent
commit
9bd4413473
2 changed files with 3 additions and 11 deletions
  1. 3 3
      src/router/guard.ts
  2. 0 8
      src/stores/configure.ts

+ 3 - 3
src/router/guard.ts

@@ -14,7 +14,6 @@ const configureStore = useConfigureStore(createPinia())
 
 export function setupRouterGuard(router: Router) {
   router.beforeEach(async (to, from, next) => {
-    configureStore.setNavigating(true)
 
     if (configureStore.configure.showTopLoadingBar) {
       loadingBar.start()
@@ -68,11 +67,12 @@ export function setupRouterGuard(router: Router) {
   })
 
   router.beforeResolve((_, __, next) => {
-    next()
+    setTimeout(() => {
+      next()
+    }, 3000)
   })
 
   router.afterEach(() => {
-    configureStore.setNavigating(false)
 
     if (configureStore.configure.showTopLoadingBar) {
       loadingBar.finish()

+ 0 - 8
src/stores/configure.ts

@@ -63,8 +63,6 @@ const DEFAULT_CONFIGURE_OPTIONS: ConfigureOptions = {
 export const useConfigureStore = defineStore('configureStore', () => {
   const configure = useStorage<ConfigureOptions>('configure', DEFAULT_CONFIGURE_OPTIONS)
 
-  const isNavigating = ref(false)
-
   const modify = (options: Partial<ConfigureOptions>) => {
     configure.value = mergeWith({}, configure.value, options, (objValue, srcValue) => {
       if (Array.isArray(objValue) && Array.isArray(srcValue)) {
@@ -79,10 +77,6 @@ export const useConfigureStore = defineStore('configureStore', () => {
     configure.value = structuredClone(DEFAULT_CONFIGURE_OPTIONS)
   }
 
-  const setNavigating = (value: boolean) => {
-    isNavigating.value = value
-  }
-
   watch(
     () => configure.value.enableTextSelect,
     (newValue) => {
@@ -95,10 +89,8 @@ export const useConfigureStore = defineStore('configureStore', () => {
 
   return {
     configure,
-    isNavigating,
     reset,
     modify,
-    setNavigating,
   }
 })