@vuemap/vue-amap
Version:
高德地图vue3版本封装
52 lines (49 loc) • 1.54 kB
JavaScript
import { defineComponent } from 'vue';
import '../../../mixins/index.mjs';
import { propsTypes } from './props.mjs';
import { useRegister } from '../../../mixins/useRegister.mjs';
var script = /* @__PURE__ */ defineComponent({
...{
name: "ElAmapControlHawkEye",
inheritAttrs: false
},
__name: "HawkEye",
props: propsTypes,
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.HawkEye"], () => {
$amapComponent = new AMap.HawkEye(options);
parentComponent.addControl($amapComponent);
resolve($amapComponent);
});
});
}, {
emits,
watchRedirectFn: {
__isOpen(flag) {
!flag ? $amapComponent.close() : $amapComponent.open();
}
},
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 null;
};
}
});
export { script as default };
//# sourceMappingURL=HawkEye.vue2.mjs.map