parent component
<index-map map-name="index-map" :pro-data="mapArr" :maker-data="listData" :marker-id.sync="markerId" :apply-flag.sync="statusModal" @marker-tap="markerTap"></index-map>
data () {
mapArr:[],
}
proChange(params){
let mapArr;
this.prolistData.forEach((item, i) => {
if (item.areaid == this.params.proid) {
mapArr = item;
}
});
console.log("mapArr",mapArr);
},
subcomponents
props: ["makerData", "markerId", "mapName","proData", "applyFlag"],
watch: {
proData: function(val, oldVal) {
console.log("====41",val);
if (val) {
this.mapPosition(this.proData);
}
},
},
mapPosition(mapArr) {
console.log(mapArr);
this.map.centerAndZoom(new T.LngLat(mapArr.longitude, mapArr.latitude), mapArr.zoom);
},
mapPosition I change the value of mapArr in the parent component the child component mapPosition does not execute