UNPKG

@vuemap/vue-amap

Version:

高德地图vue3版本封装

62 lines (59 loc) 1.86 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: "ElAmapControlMapType", inheritAttrs: false }, __name: "MapType", props: buildProps({ defaultType: { type: Number }, // 初始化默认图层类型。 取值为0:默认底图 取值为1:卫星图 默认值:0 showTraffic: { type: Boolean, default: false }, // 叠加实时交通图层 默认值:false showRoad: { type: Boolean, default: false } // 叠加路网图层 默认值:false }), emits: ["init"], setup(__props, { expose: __expose, emit: __emit }) { const emits = __emit; let $amapComponent; const { $$getInstance, parentInstance } = useRegister((options, parentComponent) => { return new Promise((resolve) => { parentComponent.plugin(["AMap.MapType"], () => { $amapComponent = new AMap.MapType(options); parentComponent.addControl($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.removeControl($amapComponent); } $amapComponent = null; } } }); __expose({ $$getInstance }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div"); }; } }); export { script as default }; //# sourceMappingURL=MapType.vue2.mjs.map