vue中$router的 beforeRouteLeave函数有2种写法
beforeRouteLeave(to,from,next){
this.path= this.$route.path
console.log(this.$route.path)
next()
}
和
beforeRouteLeave:(to,from,next)=>{
this.path= this.$route.path
console.log(this.$route.path)
next()
}
在函数中写的普通代码不报错,但是箭头函数中对this.$route 操作就会报错获取不到,不知道为啥,记录一下