fix(amap):core
This commit is contained in:
parent
3fd8831503
commit
9b9a3a7f9e
|
@ -26,30 +26,29 @@ export default function MapContainer() {
|
|||
mapStyle: "amap://styles/darkblue",
|
||||
resizeEnable: true,
|
||||
});
|
||||
// const district = new Amap.DistrictSearch({
|
||||
// subdistrict: 3, //返回下一级行政区
|
||||
// extensions: "all", //返回行政区边界坐标组等具体信息
|
||||
// level: "street", //查询行政级别为 市
|
||||
// });
|
||||
// district.search("510116", function (status,result){
|
||||
// console.log(result);
|
||||
// if(status === "complete"){
|
||||
// const bundler = result.districtList[0].boundaries;
|
||||
// const polygon = new Amap.Polygon({
|
||||
// map: amap,
|
||||
// path: bundler,
|
||||
// strokeColor: "#fff", //线颜色
|
||||
// strokeOpacity: 1, //线透明度
|
||||
// strokeWeight: 3, //线宽
|
||||
// fillColor: "#fff", //填充色
|
||||
// fillOpacity: 0.4, //填充透明度
|
||||
// });
|
||||
// // amap.add(polygon)
|
||||
// amap.setFitView();
|
||||
// }
|
||||
// })
|
||||
const district = new Amap.DistrictSearch({
|
||||
subdistrict: 3, //返回下一级行政区
|
||||
extensions: "all", //返回行政区边界坐标组等具体信息
|
||||
level: "street", //查询行政级别为 市
|
||||
});
|
||||
district.search("510116", function (status,result){
|
||||
if(status === "complete"){
|
||||
const bundler = result.districtList[0].boundaries;
|
||||
const polygon = new Amap.Polygon({
|
||||
map: amap,
|
||||
path: bundler,
|
||||
strokeColor: "#ef9363", //线颜色
|
||||
strokeOpacity: 0.8, //线透明度
|
||||
strokeWeight: 2, //线宽
|
||||
fillColor: "#ef9363", //填充色
|
||||
fillOpacity: 0.3, //填充透明度
|
||||
});
|
||||
amap.add(polygon)
|
||||
amap.setFitView();
|
||||
}
|
||||
})
|
||||
|
||||
// setmaps(amap);
|
||||
setmaps(amap);
|
||||
// addMaket(Amap,amap);
|
||||
MapUtl.loadMap = Amap;
|
||||
MapUtl.amap = amap;
|
||||
|
|
Loading…
Reference in New Issue