推荐用第二种:
方法一:用watch
watch{
'$router': function(to, from){
this.newCreate(); // 因为刷新页面不会重新走created
}
}
方法二:在router-view 标签上加":key"
<!-- $route是当前正在跳转的路由 -->
<router-view :key="$route.fullPath"/>
watch{
'$router': function(to, from){
this.newCreate(); // 因为刷新页面不会重新走created
}
}
<!-- $route是当前正在跳转的路由 -->
<router-view :key="$route.fullPath"/>
本文标题:vue路由跳转相同页面,不刷新
本文链接:https://www.haomeiwen.com/subject/thokbltx.html
网友评论