记录:vue中beforeRouteEnter使用this的方法
data() {
return {
active: 1
}
},
beforeRouteEnter(to, from, next) {
next((vm) => {
if (from.query.active) {
vm.$nextTick(() => {
vm.active = from.query.active
})
vm.onClick()
}
})
},
methods: {
onClick() {
console.log('ssss')
}
}