fix[TagsView]: fixed close last page bug(#1866)
This commit is contained in:
		| @@ -145,7 +145,7 @@ export default { | |||||||
|     closeSelectedTag(view) { |     closeSelectedTag(view) { | ||||||
|       this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => { |       this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => { | ||||||
|         if (this.isActive(view)) { |         if (this.isActive(view)) { | ||||||
|           this.toLastView(visitedViews) |           this.toLastView(visitedViews, view) | ||||||
|         } |         } | ||||||
|       }) |       }) | ||||||
|     }, |     }, | ||||||
| @@ -160,16 +160,22 @@ export default { | |||||||
|         if (this.affixTags.some(tag => tag.path === view.path)) { |         if (this.affixTags.some(tag => tag.path === view.path)) { | ||||||
|           return |           return | ||||||
|         } |         } | ||||||
|         this.toLastView(visitedViews) |         this.toLastView(visitedViews, view) | ||||||
|       }) |       }) | ||||||
|     }, |     }, | ||||||
|     toLastView(visitedViews) { |     toLastView(visitedViews, view) { | ||||||
|       const latestView = visitedViews.slice(-1)[0] |       const latestView = visitedViews.slice(-1)[0] | ||||||
|       if (latestView) { |       if (latestView) { | ||||||
|         this.$router.push(latestView) |         this.$router.push(latestView) | ||||||
|       } else { |       } else { | ||||||
|         // You can set another route |         // now the default is to redirect to the home page if there is no tags-view, | ||||||
|         this.$router.push('/') |         // you can adjust it according to your needs. | ||||||
|  |         if (view.name === 'Dashboard') { | ||||||
|  |           // to reload home page | ||||||
|  |           this.$router.replace({ path: '/redirect' + view.fullPath }) | ||||||
|  |         } else { | ||||||
|  |           this.$router.push('/') | ||||||
|  |         } | ||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     openMenu(tag, e) { |     openMenu(tag, e) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user