@vuemap/vue-amap
Version:
高德地图vue3版本封装
61 lines (58 loc) • 1.98 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: "ElAmapControlControlBar",
inheritAttrs: false
},
__name: "ControlBar",
props: buildProps({
// 控件停靠位置 { top: 5; left: 5; right: 5; bottom: 5 } 或者 'LT': 左上角, 'RT': 右上角, 'LB': 左下角, 'RB': 右下角
position: {
type: [String, Object]
},
// 相对于地图容器左上角的偏移量,正数代表向右下偏移。默认为AMap.Pixel(10,10)
offset: {
type: Array
},
// 是否显示倾斜、旋转按钮。默认为 true
showControlButton: {
type: Boolean,
default: true
}
}),
emits: ["init"],
setup(__props, { expose: __expose, emit: __emit }) {
const emits = __emit;
let $amapComponent;
const { $$getInstance, parentInstance } = useRegister((options, parentComponent) => {
return new Promise((resolve) => {
parentComponent.plugin(["AMap.ControlBar"], () => {
$amapComponent = new AMap.ControlBar(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 openBlock(), createElementBlock("div");
};
}
});
export { script as default };
//# sourceMappingURL=ControlBar.vue2.mjs.map