We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
loadMap(map: any) { console.log('loaded'); console.log(this.map); this.map = map; const BMap: any = window['BMap']; const marker = this.map.getOverlays()[0]; const label = new BMap.Label('<div class="newPointLabel"><h1>此位置不对吗?</h1><p>快来拖动此图标到达正确位置</p></div>', { offset: new BMap.Size(-90, -116), enableMassClear: false }); label.setStyle({ backgroundColor: 'none', border: 0 }); marker.setLabel(label); }
新手,请大牛见谅~
路由切换之后map.getOverlays()返回空数组导致无法获取maker,刷新则无问题,
map.getOverlays()
maker
我把这些写在loadMap里面可以吗?
loadMap
请问一下可能是什么原因呢?
The text was updated successfully, but these errors were encountered:
因为marker是在创建完map之后才创建的,所以的确有这个可能性在loadMap回调里使用this.map.getOverlays()拿到的是空数组。至于你说页面刷新一下就没事了,我还真想不出来为什么。
marker
map
this.map.getOverlays()
不过看你的代码,应该是需要给marker上加一个label,那么我觉得和 #33 有相同的诉求,我会在下一个版本里为marker也加一个loaded事件,这样你用这个事件,就可以保证拿到你要的marker实例了。
label
loaded
需求敦促我加把劲,我尽快把这个功能做了并上线
Sorry, something went wrong.
Finish: #34. add loaded event for marker component
87875eb
试试4.1.0吧,我给marker增加了loaded事件,你的操作写在那个里面
4.1.0
No branches or pull requests
新手,请大牛见谅~
路由切换之后
map.getOverlays()
返回空数组导致无法获取maker
,刷新则无问题,我把这些写在
loadMap
里面可以吗?请问一下可能是什么原因呢?
The text was updated successfully, but these errors were encountered: