你好问下:
A:列表页,
B:详情页
A进入B,当前TagsView,2个
B处理业务结束后,关闭B跳转到A,或者关闭B跳转到另一个页面C
怎么实现?
以下是关闭当前tagView
修改:/src/store/modules/tagsView.js
在第72行下面加上:
delCurrentViews({ commit, state }, params) {
commit('DEL_VISITED_VIEWS', params.view)
const latestView = [...state.visitedViews].slice(-1)[0]
if (latestView) {
params.$router.push(latestView)
} else {
params.$router.push('/')
}
}
然后在你的页面里使用:
this.$store.dispatch('delCurrentViews', {
view: this.$route,
$router: this.$router
})
希望可以帮到你。
好的,谢谢。
var view = this.$route
this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => {
const latestView = visitedViews.slice(-1)[0]
if (latestView) {
this.$router.push(latestView)
} else {
if (view.name === 'Dashboard') {
this.$router.replace({ path: '/redirect' + view.fullPath })
} else {
this.$router.push('/')
}
}
})
Most helpful comment
以下是关闭当前tagView
修改:/src/store/modules/tagsView.js
在第72行下面加上:
然后在你的页面里使用:
希望可以帮到你。