File tree 1 file changed +4
-14
lines changed
1 file changed +4
-14
lines changed Original file line number Diff line number Diff line change @@ -28,13 +28,8 @@ const mutations = {
28
28
}
29
29
} ,
30
30
DEL_CACHED_VIEW : ( state , view ) => {
31
- for ( const i of state . cachedViews ) {
32
- if ( i === view . name ) {
33
- const index = state . cachedViews . indexOf ( i )
34
- state . cachedViews . splice ( index , 1 )
35
- break
36
- }
37
- }
31
+ const index = state . cachedViews . indexOf ( view . name )
32
+ index > - 1 && state . cachedViews . splice ( index , 1 )
38
33
} ,
39
34
40
35
DEL_OTHERS_VISITED_VIEWS : ( state , view ) => {
@@ -43,13 +38,8 @@ const mutations = {
43
38
} )
44
39
} ,
45
40
DEL_OTHERS_CACHED_VIEWS : ( state , view ) => {
46
- for ( const i of state . cachedViews ) {
47
- if ( i === view . name ) {
48
- const index = state . cachedViews . indexOf ( i )
49
- state . cachedViews = state . cachedViews . slice ( index , index + 1 )
50
- break
51
- }
52
- }
41
+ const index = state . cachedViews . indexOf ( view . name )
42
+ index > - 1 && ( state . cachedViews = state . cachedViews . slice ( index , index + 1 ) )
53
43
} ,
54
44
55
45
DEL_ALL_VISITED_VIEWS : state => {
You can’t perform that action at this time.
0 commit comments