UNPKG

@vuemap/vue-amap

Version:

高德地图vue3版本封装

79 lines (76 loc) 2.29 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: "ElAmapLabelMarker", inheritAttrs: false }, __name: "LabelMarker", props: buildProps({ name: { type: String }, // 标注名称,作为标注标识,并非最终在地图上显示的文字内容,显示文字内容请设置 opts.text.content position: { type: [Array, Object], required: true }, // 标注位置 zooms: { type: Array }, // 点标记显示的层级范围,超过范围不显示。默认值:zooms: [2, 20] opacity: { type: Number }, // 标注透明度,默认值: 1 rank: { type: Number }, // 避让优先级,获取标注的优先级,该优先级用于 labelsLayer 支持避让时,rank 值大的标注会避让掉 rank 值低的标注。默认值:1 icon: { type: Object }, // 标注图标设置 text: { type: Object }, // 标注文本设置 extData: null, rotation: { type: Number } }), 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.LabelMarker(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; } } }); __expose({ $$getInstance }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div"); }; } }); export { script as default }; //# sourceMappingURL=LabelMarker.vue2.mjs.map