需求:点击返回按钮 返回前一页面 并关闭当前页面的tagView
实现:this.$store.state.tagsView.visitedViews.splice(this.$store.state.tagsView.visitedViews.findIndex(item => item.path === this.$route.path), 1)
将上述代码复制到返回按钮的点击事件中即可
本文介绍了如何在Vue.js应用中利用Vuex状态管理库来实现点击返回按钮时,不仅返回上一页面,还能关闭当前页面的tagView。关键代码是通过`$store.state.tagsView.visitedViews.splice()`方法找到并移除当前路由对应的视图记录,确保页面状态得到正确更新。
需求:点击返回按钮 返回前一页面 并关闭当前页面的tagView
实现:this.$store.state.tagsView.visitedViews.splice(this.$store.state.tagsView.visitedViews.findIndex(item => item.path === this.$route.path), 1)
将上述代码复制到返回按钮的点击事件中即可
4874

被折叠的 条评论
为什么被折叠?