【发布时间】:2021-11-17 09:10:46
【问题描述】:
我有经度和纬度的对象?
data(){
return{
center2:{lat:0,lng:0}
}
}
我正在尝试这样观看,但无法正常工作
watch:{
"center2.lat":function (newValue, oldValue) {
this.center2.lat = newValue;
}
, "center2.lng":function (newValue, oldValue) {
this.center2.lng = newValue;
}
},
我该怎么做?
【问题讨论】:
-
这是奇怪的代码。你观察并改变它。这就像变异状态的递归......一旦值发生变化,就会永远保持变异
标签: javascript vue.js vuejs3