hookehuyr

fix 处理地图刷新问题

1 <!-- 1 <!--
2 * @Date: 2023-05-19 14:54:27 2 * @Date: 2023-05-19 14:54:27
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2023-07-05 15:43:05 4 + * @LastEditTime: 2023-07-05 17:05:08
5 * @FilePath: /map-demo/src/views/index.vue 5 * @FilePath: /map-demo/src/views/index.vue
6 * @Description: 地图主体页面 6 * @Description: 地图主体页面
7 --> 7 -->
...@@ -236,7 +236,11 @@ export default { ...@@ -236,7 +236,11 @@ export default {
236 // 使用之前都要再获取一下地址 236 // 使用之前都要再获取一下地址
237 this.getLocation() 237 this.getLocation()
238 // 设置贴片地图 238 // 设置贴片地图
239 - this.setTitleLayer() 239 + this.setTitleLayer();
240 + // 每隔5分钟刷新地图
241 + setInterval(() => {
242 + this.map.resize();
243 + }, 1000 * 60 * 5);
240 }, 244 },
241 watch: { 245 watch: {
242 show_popup(val) { 246 show_popup(val) {
...@@ -292,6 +296,7 @@ export default { ...@@ -292,6 +296,7 @@ export default {
292 ], 296 ],
293 features: ['bg', 'road'], // 设置地图上显示的元素种类 297 features: ['bg', 'road'], // 设置地图上显示的元素种类
294 animateEnable: false, // 地图平移过程中是否使用动画 298 animateEnable: false, // 地图平移过程中是否使用动画
299 + resizeEnable: true,
295 }); 300 });
296 // 添加地图点击事件 301 // 添加地图点击事件
297 this.map.on("click", this.showInfoClick); 302 this.map.on("click", this.showInfoClick);
......