UNPKG

@vuemap/vue-amap

Version:

高德地图vue3版本封装

73 lines (70 loc) 2.12 kB
import { defineComponent, openBlock, createElementBlock } from 'vue'; import '../../../../mixins/index.mjs'; import { buildProps } from '../../../../utils/buildHelper.mjs'; import { useRegister } from '../../../../mixins/useRegister.mjs'; var script = /* @__PURE__ */ defineComponent({ ...{ name: "ElAmapLayerTraffic", inheritAttrs: false }, __name: "Traffic", props: buildProps({ autoRefresh: { type: Boolean, defult: true }, // 是否自动更新数据,默认开启 interval: { type: Number }, // 自动更新数据的间隔毫秒数,默认 180ms zooms: { type: Array }, // 支持的缩放级别范围,默认范围 [2-30] opacity: { type: Number }, // 透明度,默认 1 tileSize: { type: Number } // 切片大小,取值: 256,表示切片大小为256 256128,表示切片大小为128 12864,表示切片大小为64*64。默认值为256 }), emits: ["init"], setup(__props, { expose: __expose, emit: __emit }) { const emits = __emit; let $amapComponent; const { $$getInstance, parentInstance } = useRegister((options, parentComponent) => { return new Promise((resolve) => { $amapComponent = new AMap.TileLayer.Traffic(options); parentComponent.add($amapComponent); resolve($amapComponent); }); }, { emits, destroyComponent() { if ($amapComponent && (parentInstance == null ? void 0 : parentInstance.$amapComponent)) { if (!(parentInstance == null ? void 0 : parentInstance.isDestroy)) { parentInstance == null ? void 0 : parentInstance.$amapComponent.remove($amapComponent); } $amapComponent = null; } } }); const stopFresh = () => { if ($amapComponent) { $amapComponent.stopFresh(); } }; __expose({ $$getInstance, stopFresh }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div"); }; } }); export { script as default }; //# sourceMappingURL=Traffic.vue2.mjs.map