this.$watch() 的使用(这里可以放在Vue生命周期钩子里):
this.$watch('query', (newQuery) => {
this.$emit('query', newQuery)
})
watch:{}的使用(一个方法):
watch:{
query(newQuery){
this.$emit('query', newQuery)
}
}
this.$watch() 的使用(这里可以放在Vue生命周期钩子里):
this.$watch('query', (newQuery) => {
this.$emit('query', newQuery)
})
watch:{}的使用(一个方法):
watch:{
query(newQuery){
this.$emit('query', newQuery)
}
}