yangyanggu / vue-amap

高德地图封装 for vue2 vue3.0
https://vue-amap.guyixi.cn/
MIT License
268 stars 15 forks source link

VueAMap.initAMapApiLoader AMap.Geocoder is not work #15

Closed timlili closed 2 years ago

timlili commented 2 years ago

import VueAMap from '@vuemap/vue-amap'; VueAMap.initAMapApiLoader({ key: 'myKey', plugin: [ 'AMap.Geocoder', 'AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PolyEditor', 'AMap.CircleEditor', 'AMap.Geolocation' ], v: '2.0', uiVersion: '1.1' })

use on map @click="test"

test: () => { new AMap.Geocoder({ radius: 1000, extensions: 'all' }); }

[Vue warn]: Error in v-on handler: "TypeError: AMap.Geocoder is not a constructor"

yangyanggu commented 2 years ago

可以看下文档,你这加载方式是vue-amap的,不是我的组件初始化的参数