add:when active tabs closed will go to last path
This commit is contained in:
parent
cb0e889829
commit
f712d4682e
|
@ -32,14 +32,17 @@ const app = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
ToggleSideBar: ({ commit }) => {
|
ToggleSideBar({ commit }) {
|
||||||
commit('TOGGLE_SIDEBAR')
|
commit('TOGGLE_SIDEBAR')
|
||||||
},
|
},
|
||||||
addVisitedViews: ({ commit }, view) => {
|
addVisitedViews({ commit }, view) {
|
||||||
commit('ADD_VISITED_VIEWS', view)
|
commit('ADD_VISITED_VIEWS', view)
|
||||||
},
|
},
|
||||||
delVisitedViews: ({ commit }, view) => {
|
delVisitedViews({ commit, state }, view) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
commit('DEL_VISITED_VIEWS', view)
|
commit('DEL_VISITED_VIEWS', view)
|
||||||
|
resolve([...state.visitedViews])
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,11 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
closeViewTabs(view, $event) {
|
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()
|
$event.preventDefault()
|
||||||
},
|
},
|
||||||
generateRoute() {
|
generateRoute() {
|
||||||
|
|
Loading…
Reference in New Issue