美文网首页
vue-router 刷新当前页面

vue-router 刷新当前页面

作者: TragueZw | 来源:发表于2019-01-14 11:57 被阅读42次

设置route

{
  path:'/redirect/:path*',
  component: () =>import('@/views/redirect/index'),
}

跳转页面页面内容

<script>
  export default {
    beforeCreate() {
      const { params, query } = this.$route
      const { path } = params
      this.$router.replace({ path: '/' + path, query })
    },

    render: function(h) {
      return h()
    }
  }
</script>

刷新方法

refresh() {
    const { fullPath } = this.$route
    this.$router.replace({
       path: '/redirect' + fullPath
    })
},

相关文章

网友评论

      本文标题:vue-router 刷新当前页面

      本文链接:https://www.haomeiwen.com/subject/fmyddqtx.html