@vuemap/vue-amap
Version:
高德地图vue3版本封装
80 lines (77 loc) • 2.29 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: "ElAmapLayerBuildings",
inheritAttrs: false
},
__name: "Buildings",
props: buildProps({
wallColor: {
type: [String, Array]
},
// 楼块侧面颜色,支持 rgba、rgb、十六进制等
roofColor: {
type: [String, Array]
},
// 楼块顶面颜色,支持 rgba、rgb、十六进制等
heightFactor: {
type: Number
},
// 楼块的高度系数因子,默认为 1,也就是正常高度
styleOpts: {
type: Object
},
// 楼块的围栏和样式设置
zooms: {
type: Array
},
// 支持的缩放级别范围,默认范围 [2-30]
opacity: {
type: Number
}
// 透明度,默认 1
}),
emits: ["init"],
setup(__props, { expose: __expose, emit: __emit }) {
const props = __props;
const emits = __emit;
let $amapComponent;
const { $$getInstance, parentInstance } = useRegister((options, parentComponent) => {
return new Promise((resolve) => {
$amapComponent = new AMap.Buildings(options);
parentComponent.add($amapComponent);
if (props.styleOpts) {
$amapComponent.setStyle(props.styleOpts);
}
resolve($amapComponent);
});
}, {
emits,
watchRedirectFn: {
__styleOpts(value) {
$amapComponent.setStyle(value);
}
},
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=Buildings.vue2.mjs.map