——Record this time that I took off my pants to fart in order to realize the internal value of the listener
When writing a bug today, I need to use the watch to monitor whether a value in the object has changed. I thought for a long time
data() { return { register: { username: "" } } }
↑ Yes, I just want to watch the username
(Thinking a little)
computed: { watchUsername() { return this.register.username; } }, watch: { watchUsername() { Console. log ("Yes, that's it!"); } }
The big guy sitting opposite me praised me directly: You're such a smart kid
I felt that something was wrong, and I decided to find a way
watch: { 'register.username'() { Console. log ("This... bother you!"); } }
Is this what people do
Good bye!