watch
data(){
return{
upload:0
}
},
watch(){
upload(newValue,oldValue){
console.log(newValue)
}
}
watch监听对象
data(){
return{
form:{
pokerState: 53,
pokerHistory: 'local'
}
},
watch(){
form{
handler(newValue,oldValue){
console.log(newValue)
}
}
}
watch监听对象属性
data(){
return{
form:{
pokerState: 53,
pokerHistory: 'local'
}
},
computed(){
pokerHistory(){
return this.form.pokerState
}
},
watch(){
pokerHistory(newValue,oldValue){
console.log(newValue)
}
}
watch监听路由变化
data(){
return{
}
},
watch(){
watch:{
"$route":"getPath" // 监听事件
},
},
methods:{
getPath(){
let path = this.$roune.path; //或得当前路径
进行逻辑判断
}
}