vue-router 刷新当前页面

2019-01-14  本文已影响42人  TragueZw

设置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
    })
},
上一篇 下一篇

猜你喜欢

热点阅读