Skip to content
Snippets Groups Projects
Commit f712d468 authored by Pan's avatar Pan
Browse files

add:when active tabs closed will go to last path

parent cb0e8898
No related branches found
No related tags found
No related merge requests found
......@@ -32,14 +32,17 @@ const app = {
}
},
actions: {
ToggleSideBar: ({ commit }) => {
ToggleSideBar({ commit }) {
commit('TOGGLE_SIDEBAR')
},
addVisitedViews: ({ commit }, view) => {
addVisitedViews({ commit }, view) {
commit('ADD_VISITED_VIEWS', view)
},
delVisitedViews: ({ commit }, view) => {
commit('DEL_VISITED_VIEWS', view)
delVisitedViews({ commit, state }, view) {
return new Promise((resolve) => {
commit('DEL_VISITED_VIEWS', view)
resolve([...state.visitedViews])
})
}
}
}
......
......@@ -17,7 +17,11 @@ export default {
},
methods: {
closeViewTabs(view, $event) {
this.$store.dispatch('delVisitedViews', view)
this.$store.dispatch('delVisitedViews', view).then((views) => {
if (this.isActive(view.path)) {
this.$router.push(views.pop().path)
}
})
$event.preventDefault()
},
generateRoute() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment