1
1
import { defineStore } from 'pinia'
2
2
import { RouteLocationNormalized } from 'vue-router'
3
3
import pinia from '../pinia'
4
- import useCachedRouteStore from '@/store/modules/cached-routes'
5
- import { findCachedRoutes } from '../help'
4
+ // import useCachedRouteStore from '@/store/modules/cached-routes'
5
+ // import { findCachedRoutes } from '../help'
6
6
7
7
const visitedRoutes = JSON . parse ( localStorage . getItem ( 'visited-routes' ) || '[]' )
8
8
@@ -30,12 +30,12 @@ const useVisitedRouteStore = defineStore('visited-routes', {
30
30
addVisitedRoute ( route : RouteLocationNormalized ) {
31
31
return new Promise ( ( resolve ) => {
32
32
if ( ! this . visitedRoutes . find ( ( it ) => it . fullPath === route . fullPath ) ) {
33
- if ( route . name ) {
34
- const cachedRoutesStore = useCachedRouteStore ( )
35
- if ( ! cachedRoutesStore . cachedRoutes . includes ( route . name as string ) ) {
36
- cachedRoutesStore . cachedRoutes . push ( route . name as string )
37
- }
38
- }
33
+ // if (route.name) {
34
+ // const cachedRoutesStore = useCachedRouteStore()
35
+ // if (!cachedRoutesStore.cachedRoutes.includes(route.name as string)) {
36
+ // cachedRoutesStore.cachedRoutes.push(route.name as string)
37
+ // }
38
+ // }
39
39
this . visitedRoutes . push ( route )
40
40
41
41
this . persistentVisitedView ( )
@@ -46,15 +46,15 @@ const useVisitedRouteStore = defineStore('visited-routes', {
46
46
removeVisitedRoute ( route : RouteLocationNormalized ) {
47
47
return new Promise < string > ( ( resolve ) => {
48
48
this . visitedRoutes . splice ( this . visitedRoutes . indexOf ( route ) , 1 )
49
- if ( route . name ) {
50
- const cachedRoutesStore = useCachedRouteStore ( )
51
- if ( cachedRoutesStore . cachedRoutes . includes ( route . name as string ) ) {
52
- cachedRoutesStore . cachedRoutes . splice (
53
- cachedRoutesStore . cachedRoutes . indexOf ( route . name as string ) ,
54
- 1
55
- )
56
- }
57
- }
49
+ // if (route.name) {
50
+ // const cachedRoutesStore = useCachedRouteStore()
51
+ // if (cachedRoutesStore.cachedRoutes.includes(route.name as string)) {
52
+ // cachedRoutesStore.cachedRoutes.splice(
53
+ // cachedRoutesStore.cachedRoutes.indexOf(route.name as string),
54
+ // 1
55
+ // )
56
+ // }
57
+ // }
58
58
this . persistentVisitedView ( )
59
59
resolve ( this . findLastRoutePath ( ) )
60
60
} )
@@ -71,8 +71,8 @@ const useVisitedRouteStore = defineStore('visited-routes', {
71
71
this . visitedRoutes = this . visitedRoutes . filter ( ( it , index ) => {
72
72
return ( it . meta && it . meta . affix ) || index >= selectIndex
73
73
} )
74
- const cachedRoutesStore = useCachedRouteStore ( )
75
- cachedRoutesStore . setCachedRoutes ( findCachedRoutes ( this . visitedRoutes ) )
74
+ // const cachedRoutesStore = useCachedRouteStore()
75
+ // cachedRoutesStore.setCachedRoutes(findCachedRoutes(this.visitedRoutes))
76
76
this . persistentVisitedView ( )
77
77
}
78
78
resolve ( selectRoute )
@@ -85,8 +85,8 @@ const useVisitedRouteStore = defineStore('visited-routes', {
85
85
this . visitedRoutes = this . visitedRoutes . filter ( ( it , index ) => {
86
86
return ( it . meta && it . meta . affix ) || index <= selectIndex
87
87
} )
88
- const cachedRoutesStore = useCachedRouteStore ( )
89
- cachedRoutesStore . setCachedRoutes ( findCachedRoutes ( this . visitedRoutes ) )
88
+ // const cachedRoutesStore = useCachedRouteStore()
89
+ // cachedRoutesStore.setCachedRoutes(findCachedRoutes(this.visitedRoutes))
90
90
this . persistentVisitedView ( )
91
91
}
92
92
resolve ( selectRoute )
@@ -97,8 +97,8 @@ const useVisitedRouteStore = defineStore('visited-routes', {
97
97
this . visitedRoutes = this . visitedRoutes . filter ( ( it ) => {
98
98
return it . meta && it . meta . affix
99
99
} )
100
- const cachedRoutesStore = useCachedRouteStore ( )
101
- cachedRoutesStore . setCachedRoutes ( findCachedRoutes ( this . visitedRoutes ) )
100
+ // const cachedRoutesStore = useCachedRouteStore()
101
+ // cachedRoutesStore.setCachedRoutes(findCachedRoutes(this.visitedRoutes))
102
102
this . persistentVisitedView ( )
103
103
resolve ( )
104
104
} )
0 commit comments