@vuemap/vue-amap
Version:
高德地图vue3版本封装
69 lines (66 loc) • 2.02 kB
JavaScript
import { defineComponent, openBlock, createElementBlock } from 'vue';
import '../../../../mixins/index.mjs';
import '../../../../utils/index.mjs';
import { buildProps } from '../../../../utils/buildHelper.mjs';
import { useRegister } from '../../../../mixins/useRegister.mjs';
var script = /* @__PURE__ */ defineComponent({
...{
name: "ElAmapLayerMapboxVectorTile",
inheritAttrs: false
},
__name: "MapboxVectorTileLayer",
props: buildProps({
url: {
type: String
},
// MVT 数据的链接地址
zooms: {
type: Array
},
// 支持的缩放级别范围,默认范围 [2,22]
dataZooms: {
type: Array
},
// 瓦片数据等级范围,超过范围会使用最大/最小等级的数据,默认 [2,18]
opacity: {
type: Number
},
// 透明度,默认 1
styles: {
type: Object
}
// 样式
}),
emits: ["init"],
setup(__props, { expose: __expose, emit: __emit }) {
const emits = __emit;
let $amapComponent;
const { $$getInstance, parentInstance } = useRegister((options, parentComponent) => {
return new Promise((resolve) => {
AMap.plugin(["AMap.MapboxVectorTileLayer"], () => {
$amapComponent = new AMap.MapboxVectorTileLayer(options);
parentComponent.addLayer($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.removeLayer($amapComponent);
}
$amapComponent = null;
}
}
});
__expose({
$$getInstance
});
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div");
};
}
});
export { script as default };
//# sourceMappingURL=MapboxVectorTileLayer.vue2.mjs.map