【类 型】:fix 地图组件改用 内置的resize()方法来刷新 宽度
【原 因】:强制刷新 会导致地图上绘制 全部消失 【过 程】: 【影 响】:
This commit is contained in:
parent
53d54d110d
commit
c8efe13930
@ -506,6 +506,14 @@ export default {
|
||||
this.map.panBy([x, y], {
|
||||
duration: 333 // 过渡持续时间,以毫秒为单位
|
||||
})
|
||||
},
|
||||
/**
|
||||
* @description:重置地图大小
|
||||
*/
|
||||
handleResize () {
|
||||
if (this.map) {
|
||||
this.map.resize()
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeDestroy () {
|
||||
|
@ -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++ // 更新mapBoxKey以触发map-box组件的重新渲染
|
||||
// }, 500)
|
||||
// setTimeout(() => {
|
||||
// if (this.plane) {
|
||||
// this.makePlane(this.plane) // 创建飞机图标
|
||||
// }
|
||||
// }, 1500)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
isCollapse: {
|
||||
handler (val) {
|
||||
if (val) {
|
||||
setTimeout(() => {
|
||||
this.$refs.mapbox.handleResize()
|
||||
}, 500)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user