Vue 关闭this.$router.push打开的标签页面并回
2020-06-16 本文已影响0人
3anLouYouGu1
通用js方法 xxx.js
// 页面 关闭标签并返回
export function goBack(o) {
o.$store.state.tagsView.visitedViews.splice(o.$store.state.tagsView.visitedViews.findIndex(item => item.path === o.$route.path), 1)
o.$router.push(o.$store.state.tagsView.visitedViews[o.$store.state.tagsView.visitedViews.length-1].path)
}
Vue页面调用 关闭标签页并回退 x.vue
import {goBack} from "@/utils/xxx";
goBack(this);