【类 型】:fix 不深度监控飞机属性

【原  因】:深度监控 导致地图一直重画飞机
【过  程】:取消watch plane属性的deep
【影  响】:
This commit is contained in:
szdot 2024-07-25 01:40:58 +08:00
parent c8efe13930
commit 79c1dc2978
2 changed files with 12 additions and 11 deletions

View File

@ -471,6 +471,7 @@ export default {
}
//
this.createPathWithArray(pathArr)//
console.log(pathArr)
//
if (isflow) {
this.map.flyTo({

View File

@ -62,7 +62,6 @@ export default {
* @description: 创建飞机图标
*/
makePlane (plane) {
console.log('hi')
let planeDefaultLngLat
if (localStorage.getItem(plane.name)) { //
planeDefaultLngLat = JSON.parse(localStorage.getItem(plane.name))
@ -74,7 +73,8 @@ export default {
}
this.$refs.mapbox.removePlanes()//
this.$refs.mapbox.makePlane(plane)//
// this.$refs.mapbox.goto({ lng: plane.lng, lat: plane.lat })//
this.$refs.mapbox.goto({ lng: plane.lng, lat: plane.lat })//
console.log('hi')
},
/**
* @description: 创建航线
@ -100,18 +100,18 @@ export default {
mounted () {
if (this.plane) {
this.makePlane(this.plane) //
if (!this.plane.planeState.battCapacity) {
mqtt.publishFun(`cmd/${this.plane.macadd}`, '{"getBattCapacity":1}')//
}
}
},
watch: {
plane: {
handler (val) {
plane (val) {
this.makePlane(val)//
if (!val.planeState.battCapacity) {
mqtt.publishFun(`cmd/${this.plane.macadd}`, '{"getBattCapacity":1}')//
}
},
deep: true
},
/**
* @description: 更新飞机位置 并画出轨迹 跟随飞机
*/
@ -125,7 +125,7 @@ export default {
if (this.localCount % 100 === 1) {
localStorage.setItem(this.plane.name, `{ "lng": ${lng}, "lat": ${lat} }`)
}
this.$refs.mapbox.setPlaneLngLat({ lng: lng, lat: lat }, 0, val, false)//
this.$refs.mapbox.setPlaneLngLat({ lng: lng, lat: lat }, 0, val, true)//
}
},
deep: true