public username = '';
public watch: Function | null = null;
handleWatch() {
this.watch = this.$watch('username', (newVal, oldVal) => {
console.log(newVal, oldVal);
});
}
handleCancelWatch() {
this.watch();
}
<button @click="handleWatch">1</button>
<button @click="handleCancelWatch">2</button>
<m-input
v-model="username"
></m-input>


1547

被折叠的 条评论
为什么被折叠?



