Skip to content

Commit

Permalink
feat(runtime-web): map 组件增加 init complete 事件通知 (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
hwaphon authored Nov 16, 2023
1 parent e8266f9 commit 34f6d85
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/runtime-web/src/components/src/api/ui/map/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,17 @@ export default class Map extends BaseElement {
this.__drawControls()
// include-points 缩放视野以包含所有给定的坐标点 (wx 和 makers 分开的)
this.__drawIncludePoints()

// 绘制完成触发 init complete 事件(业务上可以通过此回调,获取 Map Context 实例,因为这个时机可以确保地图一定已经绘制)
this.dispatchEvent(
new CustomEvent('initcomplete', {
detail: {
id: this.id
},
bubbles: true,
composed: true
})
)
}

getEvent() {
Expand Down

0 comments on commit 34f6d85

Please sign in to comment.