sundjly
sundjly
经过查看源码,发现是promise异步的原因导致的,因为每次重新进入会生成新的bMapInstance,而自定义覆盖物取到的bMapInstance是上一次的,所以没有加载出来(加载到了上一次的地图实例里面了)。通过setTimeout的hook可以暂时解决这个问题, 在Map/index.js中 ``` componentDidMount() { const { ak } = this.props; if (ak) { this.getMapScript().then(this.init); } else if (global.BMap) { this.init(global.BMap); } else { console.warn('BMap is undefined'); } } ```...
目前自定义覆盖物获取不到当前实例,可以在自定义覆盖物调用的时候用setTimeout,如下 setTimeout(()=> { this.map = window.bMapInstance // instance为自定义覆盖物的实例 this.instance = instance; this.map.addOverlay(this.instance); },300)
@JserWang 您好!是指通过Array.map()方法返回的一组自定义覆盖物,在缩放的时候,其绝对位置发生改变(如地图缩小后,自定义覆盖物没有聚合在一起),之前把偏移量改成固定值还是有问题
I also have the same problem; node 16 Linux
 history传递参数报错,请问是什么原因
# 遇到的一些面试题汇集: ## 1. 关于js模块的:来自 https://github.com/mqyqingfeng/Blog/issues/108 > requirejs 为全局添加了 define 函数,你只要按照这种约定的方式书写这个模块即可。 ``` // 模块引入 // main.js require(['./add', './square'], function(addModule, squareModule) { console.log(addModule.add(1, 1)) console.log(squareModule.square(3)) }); // add 模块声明 define(function() {...