File tree Expand file tree Collapse file tree 1 file changed +4
-14
lines changed Expand file tree Collapse file tree 1 file changed +4
-14
lines changed Original file line number Diff line number Diff line change @@ -28,13 +28,8 @@ const mutations = {
2828 }
2929 } ,
3030 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 )
3833 } ,
3934
4035 DEL_OTHERS_VISITED_VIEWS : ( state , view ) => {
@@ -43,13 +38,8 @@ const mutations = {
4338 } )
4439 } ,
4540 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 ) )
5343 } ,
5444
5545 DEL_ALL_VISITED_VIEWS : state => {
You can’t perform that action at this time.
0 commit comments