yanzhen-design-vue
Version:
70 lines (69 loc) • 2.25 kB
JavaScript
;
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const vue = require("vue");
const antDesignVue = require("ant-design-vue");
const iconsVue = require("@ant-design/icons-vue");
const map = require("./map.cjs");
const _hoisted_1 = { class: "cl-map-control" };
const _hoisted_2 = { class: "location-detail" };
const _hoisted_3 = {
id: "gd-map",
class: "map"
};
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
...{ name: map.mapName },
__name: "map",
props: map.mapProps,
setup(__props) {
const { class: wrapClass } = map.mapOptions;
const mapVisible = vue.ref(false);
let outClickFn;
const vOutClick = {
beforeMount(el, binding) {
outClickFn = (e) => {
if (!el.contains(e.target)) {
binding.value();
}
};
document.addEventListener("click", outClickFn);
},
beforeUnmount() {
if (outClickFn) {
document.removeEventListener("click", outClickFn);
}
}
};
const handleMapVisible = () => {
mapVisible.value = !mapVisible.value;
};
const handleCloseMap = () => {
mapVisible.value = false;
};
return (_ctx, _cache) => {
return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
class: vue.normalizeClass(["cl-map-warp", vue.unref(wrapClass)])
}, [
vue.createElementVNode("div", _hoisted_1, [
vue.createVNode(vue.unref(iconsVue.EnvironmentOutlined), { class: "location-icon" }),
vue.createElementVNode("span", _hoisted_2, vue.toDisplayString(_ctx.location), 1),
vue.createVNode(vue.unref(antDesignVue.Button), {
type: "primary",
size: "small",
onClick: handleMapVisible
}, {
default: vue.withCtx(() => _cache[0] || (_cache[0] = [
vue.createTextVNode("重新定位")
])),
_: 1
})
]),
vue.withDirectives(vue.createElementVNode("div", _hoisted_3, null, 512), [
[vue.vShow, mapVisible.value]
])
], 2)), [
[vOutClick, handleCloseMap]
]);
};
}
});
exports.default = _sfc_main;