UNPKG

@rsmap/vue3ol

Version:

使用 vue3 风格封装后的 Openlayer 地图组件库。

16 lines (14 loc) 760 B
import { Ref, ShallowRef } from 'vue'; import { Map } from 'ol'; import { Layer } from 'ol/layer'; import { IfAny } from '@vue/shared'; /** * Create a Layer * @param LayerClass The Class of the source which should be created * @param props The properties which should be passed to the LayerClass * @param eventsToHandle The event names list for events that should be passed from the layer through the component */ export default function useLayer<T extends Layer>(LayerClass: new (...args: any[]) => T, props: ConstructorParameters<typeof LayerClass>[0], eventsToHandle?: string[], forceUpdate?: boolean): { layer: Ref<any> extends T ? T extends T & Ref<any> ? IfAny<T, ShallowRef<T>, T> : ShallowRef<T> : ShallowRef<T>; map: Map | undefined; };