在keep-alive時
beforeRouteEnter(to, from, next){
next(vm=>{
console.log(vm)
// 每次進入路由執行
vm.getData()
})
},
mounted: function () {
// 隻執行一次的方法
this.getData()
},
在keep-alive時
beforeRouteEnter(to, from, next){
next(vm=>{
console.log(vm)
// 每次進入路由執行
vm.getData()
})
},
mounted: function () {
// 隻執行一次的方法
this.getData()
},