先上效果图:
第一步:在 public的index.html中引入百度地图api,ak需要在百度开放平台申请
第二步:定义一个构造函数用于批量创建地图遮盖物
// ---------------------------- 1.定义自定义覆盖物的构造函数
function SquareOverlay(this: any, center: any, data: any) {
this._center = center;
this._data = data;
}
SquareOverlay.prototype = new window.BMapGL.Overlay();
SquareOverlay.prototype.initialize = function (map: Window["BMapGL"]): HTMLElement {