场景:打开下图的这几个标签,再开一个浏览页或者关闭此浏览页再重新打开项目,标签依然存在。
正确场景:
import { mapActions, mapMutations } from "vuex";
methods: { ...mapActions(["handleLogin", "getUserInfo", 'handleLogOut', "superToCommon", "commonToSuper"]), ...mapMutations([ 'closeTag', 'setTagNavList' ]), backToSuper() { this.commonToSuper(this.$store.state.user.adminTenantId).then(res => {}) this.$set(this,"btnShow", false) this.turnToPage(this.$config.homeName); let res = this.$store.state.app.tagNavList.filter(item => item.name === this.$config.homeName); this.setTagNavList(res); }, turnToPage (route) { let { name, params, query } = {} if (typeof route === 'string') name = route else { name = route.name params = route.params query = route.query } if (name.indexOf('isTurnByHref_') > -1) { window.open(name.split('_')[1]) return } this.$router.push({ name, params, query }) }, },
this.turnToPage(this.$config.homeName); let res = this.$store.state.app.tagNavList.filter(item => item.name === this.$config.homeName); this.setTagNavList(res);