【类 型】:fix 地图组件改用 内置的resize()方法来刷新 宽度
【原 因】:强制刷新 会导致地图上绘制 全部消失 【过 程】: 【影 响】:
This commit is contained in:
parent
53d54d110d
commit
c8efe13930
@ -506,6 +506,14 @@ export default {
|
|||||||
this.map.panBy([x, y], {
|
this.map.panBy([x, y], {
|
||||||
duration: 333 // 过渡持续时间,以毫秒为单位
|
duration: 333 // 过渡持续时间,以毫秒为单位
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* @description:重置地图大小
|
||||||
|
*/
|
||||||
|
handleResize () {
|
||||||
|
if (this.map) {
|
||||||
|
this.map.resize()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeDestroy () {
|
beforeDestroy () {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="h-100">
|
<div class="h-100">
|
||||||
<map-box ref="mapbox" :key="mapBoxKey">
|
<map-box ref="mapbox">
|
||||||
<template #content>
|
<template #content>
|
||||||
<BatteryStatus :plane="plane" />
|
<BatteryStatus :plane="plane" />
|
||||||
<PlaneStatus :plane="plane" />
|
<PlaneStatus :plane="plane" />
|
||||||
@ -129,24 +129,19 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
deep: true
|
deep: true
|
||||||
}
|
},
|
||||||
/**
|
/**
|
||||||
* @description: 侧边栏缩进有变化时 地图重新自适应
|
* @description: 侧边栏缩进有变化时 地图重新自适应
|
||||||
*/
|
*/
|
||||||
// isCollapse: {
|
isCollapse: {
|
||||||
// handler (val) {
|
handler (val) {
|
||||||
// if (val) {
|
if (val) {
|
||||||
// setTimeout(() => {
|
setTimeout(() => {
|
||||||
// this.mapBoxKey++ // 更新mapBoxKey以触发map-box组件的重新渲染
|
this.$refs.mapbox.handleResize()
|
||||||
// }, 500)
|
}, 500)
|
||||||
// setTimeout(() => {
|
}
|
||||||
// if (this.plane) {
|
}
|
||||||
// this.makePlane(this.plane) // 创建飞机图标
|
}
|
||||||
// }
|
|
||||||
// }, 1500)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user