Vue对数据变更只监听一次
stackblitz
演示
var unwatch = this.$watch('test', (newValue, oldValue) => {
// 之后取消观察
this.testText = `监听到了点击${this.test}次`;
unwatch();
});
var unwatch = this.$watch('test', (newValue, oldValue) => {
// 之后取消观察
this.testText = `监听到了点击${this.test}次`;
unwatch();
});