You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
373 B
13 lines
373 B
|
3 years ago
|
/** 为天地图组件实例添加事件监听 */
|
||
|
|
export function useEvent({ events, emit, instance, emitted, extData }: any): void {
|
||
|
|
if (events instanceof Object) {
|
||
|
|
events = Object.keys(events);
|
||
|
|
}
|
||
|
|
events.forEach((event: string) => {
|
||
|
|
instance.addEventListener(event, (e: any) => {
|
||
|
|
emit(event, { ...e, extData });
|
||
|
|
emitted?.(event);
|
||
|
|
});
|
||
|
|
});
|
||
|
|
}
|