问题
AMap插件一搬有三个选项,options、方法、事件,事件调用方法:
如图:
如何调用:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| ...some code window.AMap.plugin(['AMap.ToolBar'],()=>{ //options填充 _this.toolBar = new window.AMap.ToolBar({ autoPosition:true, noIpLocate:true, visible: false }); //事件调用监听 _this.toolBar.on('location',(x,y)=>{ _this.setState({ isGPS:false, currentLocation: 'loading...' }); }) } map.addControl(_this.toolBar); }); ...some code
|
相关链接:使用自己的栅格图
1 2 3 4 5 6 7
| this.alamapLayer = null; //创建map之后,执行 _this.alamapLayer = new window.AMap.TileLayer({ tileUrl:'http://-------------------/map/[z]/[y]/[x]', zIndex:1 }) _this.alamapLayer.setMap(map);
|