react-amap填坑指南

使用AMapUI 组件库时,报错:XX is not a constructor

react-amap的版本得升级到 1.1.1及以上,支持加载 AMapUI 组件库

1.  react-amap版本卸载package.json里面"react-amap": "^1.2.7"

2.  amap版本根据react-amap文档,写在Map组件里即可

<Map
    version={'1.4.4'}//amap版本
    amapkey={'XXXXXX'}
    plugins={['ToolBar']}
    center={this.center}
    zoom={15}
    expandZoomRange={true}
    zooms={zooms}
    animateEnable={true}
    events={this.mapEvents}
    useAMapUI//加此参数
> </Map>

猜你喜欢

转载自blog.csdn.net/gytha_1/article/details/80549381