/
dnischeta
/
mapgl-vue
Обзор
Документация
Войти
/
dnischeta
/
mapgl-vue
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
src/plugin.ts
18 строк
458 B
Dmitry Nischeta
Initial
19 окт 2024, 09:42
19 окт 2024, 09:42
1043fa0
Код
Авторство
О чём код?
import { load } from '@2gis/mapgl' import { shallowRef, type Plugin } from 'vue' import type { Mapgl } from './types' type MapglPluginOptions = { url: string } export const plugin: Plugin<MapglPluginOptions[]> = { install(app, options) { const url: string | undefined = options?.url const sdk = shallowRef<Mapgl | undefined>() load(url).then(mapgl => { sdk.value = mapgl }) app.config.globalProperties.$mapgl = { sdk } }, }