@vuemap/vue-amap
Version:
高德地图vue3版本封装
72 lines (67 loc) • 2.01 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
require('../../../../mixins/index.js');
var buildHelper = require('../../../../utils/buildHelper.js');
var useRegister = require('../../../../mixins/useRegister.js');
var script = /* @__PURE__ */ vue.defineComponent({
...{
name: "ElAmapLayerImage",
inheritAttrs: false
},
__name: "Image",
props: buildHelper.buildProps({
url: {
type: String,
required: true
},
// 图片地址链接
zoom: {
type: Array
},
// 支持的缩放级别范围,默认范围 [2-30]
bounds: {
type: [Array, Object]
},
// 图片的范围大小经纬度,如果传递数字数组类型: [minlng,minlat,maxlng,maxlat] 或 AMap.Bounds
opacity: {
type: Number
}
// 透明度,默认 1
}),
emits: ["init"],
setup(__props, { expose: __expose, emit: __emit }) {
const emits = __emit;
let $amapComponent;
const { $$getInstance, parentInstance } = useRegister.useRegister((options, parentComponent) => {
return new Promise((resolve) => {
$amapComponent = new AMap.ImageLayer(options);
parentComponent.addLayer($amapComponent);
resolve($amapComponent);
});
}, {
emits,
watchRedirectFn: {
__url(value) {
$amapComponent.setImageUrl(value);
}
},
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 vue.openBlock(), vue.createElementBlock("div");
};
}
});
exports.default = script;
//# sourceMappingURL=Image.vue2.js.map