日常开发记录-点击按钮触发 close 方法关闭当前路由页面,跳转列表页

关闭当前路由,跳转其他页面

close() {
      // 返回上级路由并关闭当前路由
      this.$store.state.tagsView.visitedViews.splice(this.$store.state.tagsView.visitedViews.findIndex(item => item.path === this.$route.path), 1)
      this.$router.push('目标页面的路由地址’)
    }

举例: 

目标页面的路由地址:'/test/list'
posted on 2022-09-13 09:50  法老的微笑  阅读(330)  评论(0)    收藏  举报