@vuemap/vue-amap
Version:
高德地图vue3版本封装
67 lines (64 loc) • 2.08 kB
JavaScript
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: "ElAmapLayerTile",
inheritAttrs: false
},
__name: "TileLayer",
props: buildProps({
tileUrl: {
type: String,
required: true
},
// 切片取图地址 如:' https://abc{0,1,2,3}.amap.com/tile?x=[x]&y=[y]&z=[z] ' [x] 、 [y] 、 [z] 分别替代切片的xyz。
zoom: {
type: Array
},
// 支持的缩放级别范围,默认范围 [2-30]
dataZooms: {
type: Array
},
// 数据支持的缩放级别范围,默认范围 [2-30]
opacity: {
type: Number
},
// 透明度,默认 1
tileSize: {
type: Number
}
// 切片大小,取值: 256,表示切片大小为256 256, 128,表示切片大小为128 128, 64,表示切片大小为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(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=TileLayer.vue2.mjs.map