@vuemap/vue-amap
Version:
高德地图vue3版本封装
60 lines (55 loc) • 1.89 kB
JavaScript
'use strict';
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: "ElAmapControlScale",
inheritAttrs: false
},
__name: "Scale",
props: buildHelper.buildProps({
position: {
type: [String, Object]
},
// 控件停靠位置 { top: 5; left: 5; right: 5; bottom: 5 } 或者 'LT': 左上角, 'RT': 右上角, 'LB': 左下角, 'RB': 右下角
offset: {
type: Array
}
// 相对于地图容器左上角的偏移量,正数代表向右下偏移。默认为AMap.Pixel(10,10)
}),
emits: ["init"],
setup(__props, { expose: __expose, emit: __emit }) {
const emits = __emit;
let $amapComponent;
const { $$getInstance, parentInstance } = useRegister.useRegister((options, parentComponent) => {
return new Promise((resolve) => {
parentComponent.plugin(["AMap.Scale"], () => {
$amapComponent = new AMap.Scale(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 vue.openBlock(), vue.createElementBlock("div");
};
}
});
exports.default = script;
//# sourceMappingURL=Scale.vue2.js.map