vue路由跳转相同页面,不刷新

2021-08-12  本文已影响0人  秀萝卜

推荐用第二种:

方法一:用watch
watch{
    '$router': function(to, from){
        this.newCreate();  // 因为刷新页面不会重新走created
    }
}
方法二:在router-view 标签上加":key"
<!-- $route是当前正在跳转的路由 -->
<router-view :key="$route.fullPath"/>
上一篇 下一篇

猜你喜欢

热点阅读