Showing
1 changed file
with
4 additions
and
4 deletions
| 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: 2025-02-11 18:36:30 | 4 | + * @LastEditTime: 2025-02-20 14:55:41 |
| 5 | * @FilePath: /map-demo/src/views/by/map.vue | 5 | * @FilePath: /map-demo/src/views/by/map.vue |
| 6 | * @Description: 公众地图主体页面 | 6 | * @Description: 公众地图主体页面 |
| 7 | --> | 7 | --> |
| ... | @@ -274,8 +274,8 @@ export default { | ... | @@ -274,8 +274,8 @@ export default { |
| 274 | const { data } = await mapAPI({ i: code }); | 274 | const { data } = await mapAPI({ i: code }); |
| 275 | this.navBarList = data.list; // 底部导航条 | 275 | this.navBarList = data.list; // 底部导航条 |
| 276 | this.mapTiles = data.level; // 获取图层 | 276 | this.mapTiles = data.level; // 获取图层 |
| 277 | - this.navKey = data.list[0]['id']; // 默认选中 第一个 id | 277 | + this.navKey = data.list.length ? data.list[0]['id'] : 0; // 默认选中 第一个 id |
| 278 | - this.navList = data.list.filter(item => item.id === this.navKey)[0]['list']; // 返回默认选中项的实体信息 | 278 | + this.navList = data.list.length ? data.list.filter(item => item.id === this.navKey)[0]['list'] : []; // 返回默认选中项的实体信息 |
| 279 | this.data_center = data.map.center.map(item => Number(item)); // 地图中心点 | 279 | this.data_center = data.map.center.map(item => Number(item)); // 地图中心点 |
| 280 | this.data_zoom = data.map.zoom; // 地图默认缩放 | 280 | this.data_zoom = data.map.zoom; // 地图默认缩放 |
| 281 | this.data_rotation = data.map.rotation; // 地图旋转角度 | 281 | this.data_rotation = data.map.rotation; // 地图旋转角度 |
| ... | @@ -382,7 +382,7 @@ export default { | ... | @@ -382,7 +382,7 @@ export default { |
| 382 | // 添加地图点击事件 | 382 | // 添加地图点击事件 |
| 383 | this.map.on("click", this.showInfoClick); | 383 | this.map.on("click", this.showInfoClick); |
| 384 | // 加载景点图层 | 384 | // 加载景点图层 |
| 385 | - this.loadMaker(this.navKey); | 385 | + this.navKey && this.loadMaker(this.navKey); |
| 386 | // | 386 | // |
| 387 | this.map.setRotation(this.data_rotation, true); | 387 | this.map.setRotation(this.data_rotation, true); |
| 388 | }, | 388 | }, | ... | ... |
-
Please register or login to post a comment