Skip to content

tagviews 关闭最后一个是首页时,跳转首页没有刷新页面的问题 #1861

@de1ck

Description

@de1ck

code
由于router,对跳转的路由没有改变时,不会触发页面刷新,所以需要使用其他方式去触发,以下是我的解决方案,利用vue-element-admin本身实现当前路由刷新的方案。

//   添加 view 入参
toLastView(visitedViews, view) {
      const latestView = visitedViews.slice(-1)[0]
      if (latestView) {
        this.$router.push(latestView)
      } else {
        // 添加一层判断,当前页是否为首页
       if (view.name=== 'Dashboard') this.$router.push('/redirect' + view.fullPath)
        // You can set another route
       else  this.$router.push('/')
      }
    },

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions