watch
是你的好夥伴
new Vue({
data () {
return {
A: null,
B: null,
C: null,
}
},
watch () {
B () {
if (this.A) {
this.C = this.A * this.B;
}
},
C () {
if (this.A) {
this.B = this.C / this.A;
}
}
}
}).$mount('#app')