Learning vue.js recently, the project needs to use watch to listen to some objects and trigger certain events!
1. The simplest input box monitoring
Input’s watch monitoring is like this That’s it, just add the parameter deep to in-depth monitoring, write like this
For some other writing methods and parameters, you can refer to the vue official website for in-depth understanding
2. Array watch monitoring
This is the result!
3. Watch monitoring of the object
When deep is false, click the button to change After the event is triggered, it cannot be monitored, and deep monitoring must be added to monitor the change of obj value.
As long as the properties in obj change (can be monitored), it will be executed handler function;
4.The watch of the specific attribute of the object