@@ -161,7 +161,7 @@
AMapLoader.load({
"key": "211dd6f989e719022aaf47ddb0659c47", // 申请好的Web端开发者Key,首次调用 load 时必填
"version": "2.0", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
- "plugins": ['plugin=AMap.Scale', 'AMap.ToolBar'],
+ "plugins": ['plugin=AMap.Scale', 'AMap.ToolBar','AMap.AutoComplete', 'AMap.PlaceSearch', 'AMap.Geocoder', 'AMap.DistrictSearch'],
"Loca": { // 是否加载 Loca, 缺省不加载
"version": '2.0.0' // Loca 版本,缺省 1.3.2
},
@@ -168,12 +168,12 @@
}
async created() {
- AMapLoader.reset();
+ // AMapLoader.reset();
// 已载入高德地图API,则直接初始化地图
if (window.AMap && window.AMapUI) {
// 未载入高德地图API,则先载入API再初始化
} else {
- await remoteLoad(`http://webapi.amap.com/maps?v=1.3&key=${MapKey}`)
+ await remoteLoad(`http://webapi.amap.com/maps?v=1.3&key=${MapKey}&plugin=AMap.AutoComplete`)
await remoteLoad('http://webapi.amap.com/ui/1.0/main.js')
@@ -210,9 +210,16 @@
AMap.plugin(
['AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.Geocoder', 'AMap.DistrictSearch'],
function() {
- var autocomplete = new AMap.Autocomplete({
+ if(AMap.Autocomplete){
+ var autocomplete = new AMap.Autocomplete({
input: 'searchValue',
})
+ }else{
+ var autocomplete = new AMap.AutoComplete({
+ input: 'searchValue',
+ })
+ }
+
var placeSearch = new AMap.PlaceSearch({
city: that.acode,
citylimit: true,
@@ -77,7 +77,7 @@
this.initMap()
@@ -31,7 +31,7 @@ AMap.initAMapApiLoader({
// 高德key
key: 'd5486742b76ab0969e4c3ce26f46dfc6',
// 插件集合 (插件按需引入)
- plugin: ['AMap.Geolocation', 'Geolocation', 'AMap.DistrictSearch', "AMap.PlaceSearch",],
+ plugin: ['AMap.Geolocation', 'Geolocation', 'AMap.DistrictSearch', "AMap.PlaceSearch",'AMap.Autocomplete', 'AMap.Geocoder', 'AMap.DistrictSearch'],
v: '1.4.4'
});
// ------------ 通过域名判断起始的登陆页面 开始 --------------------