We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
请介绍一下Vue的侦听器。
The text was updated successfully, but these errors were encountered:
使用watch来响应数据的变化 一般用于异步或者开销较大的操作 watch 中的属性 一定是data 中 已经存在的数据 当需要监听一个对象的改变时,普通的watch方法无法监听到对象内部属性的改变,只有data中的数据才能够监听到变化,此时就需要deep属性对对象进行深度监听
Sorry, something went wrong.
首先,watch - 侦听器 是被动的,他是监听到数据变化后才会触发watch,然后去更新数据, 这个时候你还发现,官网所说,当多个data中对象数据变化时,你就会写监听多个对象,就会很冗余 所以说watch比较适用与当一个对象变化来改变父组件或者子组件内多个对象或者条件的变化时
而类似watch的computed是主动的,他是你主动去计算多个变量,改变他们之间的算法,以达到改变数据的目的, 然而呢数据的更新是需要触发重新渲染。 所以说computed更加适用于多个变量的改变引起某一个数据或对象的改变时
No branches or pull requests
请介绍一下Vue的侦听器。
The text was updated successfully, but these errors were encountered: