【类 型】:fix 不深度监控飞机属性
【原 因】:深度监控 导致地图一直重画飞机 【过 程】:取消watch plane属性的deep 【影 响】:
This commit is contained in:
parent
c8efe13930
commit
79c1dc2978
@ -471,6 +471,7 @@ export default {
|
||||
}
|
||||
// 创建轨迹
|
||||
this.createPathWithArray(pathArr)// 创建轨迹
|
||||
console.log(pathArr)
|
||||
// 镜头跟随飞机
|
||||
if (isflow) {
|
||||
this.map.flyTo({
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user