Closed timlili closed 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"
可以看下文档,你这加载方式是vue-amap的,不是我的组件初始化的参数
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"