const app = {
data(){
return {
form: {
name: '',
password: ''
}
}
},
watch: {
form: {
handler(form, oldForm){
console.log(form, oldForm);
},
deep: true
}
}
}
Vue.createApp(app).mount('#app')
<script src="https://unpkg.com/vue@next"></script>
<main id="app">
<form>
<input v-model="form.name"/>
<input v-model="form.password"/>
</form>
</main>
I got a deep watcher for an object value, accroding to the document, it should get both the previous and current value of the object been watched.
But in this code, the new value and the old value returned by the deep watcher are always same. Why is that?
Thanks a lot for anyone help!