【类 型】:fix 地图组件改用 内置的resize()方法来刷新 宽度

【原  因】:强制刷新 会导致地图上绘制 全部消失
【过  程】:
【影  响】:
This commit is contained in:
szdot 2024-07-25 01:19:15 +08:00
parent 53d54d110d
commit c8efe13930
2 changed files with 19 additions and 16 deletions

View File

@ -506,6 +506,14 @@ export default {
this.map.panBy([x, y], {
duration: 333 //
})
},
/**
* @description:重置地图大小
*/
handleResize () {
if (this.map) {
this.map.resize()
}
}
},
beforeDestroy () {

View File

@ -1,6 +1,6 @@
<template>
<div class="h-100">
<map-box ref="mapbox" :key="mapBoxKey">
<map-box ref="mapbox">
<template #content>
<BatteryStatus :plane="plane" />
<PlaneStatus :plane="plane" />
@ -129,24 +129,19 @@ export default {
}
},
deep: true
}
},
/**
* @description: 侧边栏缩进有变化时 地图重新自适应
*/
// isCollapse: {
// handler (val) {
// if (val) {
// setTimeout(() => {
// this.mapBoxKey++ // mapBoxKeymap-box
// }, 500)
// setTimeout(() => {
// if (this.plane) {
// this.makePlane(this.plane) //
// }
// }, 1500)
// }
// }
// }
isCollapse: {
handler (val) {
if (val) {
setTimeout(() => {
this.$refs.mapbox.handleResize()
}, 500)
}
}
}
}
}
</script>