feat(maps): 支持自定义高德地图 JS 版本#2863
Conversation
修复 issue #2862 允许用户通过 version 配置项自定义高德地图 JS 版本,默认为 2.0
There was a problem hiding this comment.
Code Review
This pull request introduces the ability to configure the AMap JSAPI version dynamically via the map configuration, defaulting to AMAP_VERSION. The review feedback highlights a variable shadowing issue where the destructured version variable conflicts with the existing class property this.version. It is recommended to rename the destructured variable to amapVersion to prevent confusion and improve code maintainability.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| token, | ||
| mapInstance, | ||
| plugin = [], | ||
| version = AMAP_VERSION, |
| await AMapLoader.load({ | ||
| key: amapKey, // 申请好的Web端开发者Key,首次调用 load 时必填 | ||
| version: AMAP_VERSION, // 指定要加载的 JSAPI 的版本 | ||
| version: version, // 指定要加载的 JSAPI 的版本 |
修复 Issue #2862
问题描述
用户希望能够自定义高德地图的 JS 版本,而不是使用硬编码的 2.0 版本。
解决方案
在
init方法中添加version配置项,允许用户通过传入配置参数自定义版本,默认为AMAP_VERSION(2.0)。代码修改
version = AMAP_VERSIONAMapLoader.load中的version参数改为使用配置值使用示例
相关 Issue