vue-tianditu2
Version:
51 lines (50 loc) • 1.62 kB
JavaScript
import { defineComponent as i, computed as p, onBeforeMount as u, watch as m, h as r } from "vue";
import { TdtMarker as c } from "../../../overlay/marker/index.mjs";
import { TdtInfowindow as l } from "../../../overlay/infowindow/index.mjs";
import { toLonLatNumberArray as s, toLngLats as f } from "../../../utils/converter.mjs";
import { useMapRoot as d } from "../../../use/mapRoot.mjs";
const L = i({
props: {
/** 显示在地图上的点数组 */
pois: { type: Array, default: () => [] },
/** 显示信息窗口的坐标 */
target: { type: Array, default: () => null },
/** 信息窗口的内容 */
content: { type: String, default: "" }
},
emits: {
/** 点击地图上的标点触发 */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
"poi-click": (e) => !0,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
"update-target": (e) => !0
},
setup(e, { emit: a }) {
const o = p(() => e.pois.map((t) => ({
position: s(t.lonlat),
extData: t
})));
return u(async () => {
const t = await d();
m(o, () => {
t == null || t.setViewport(f(o.value.map((n) => n.position)));
});
}), () => r("div", null, [
...o.value.map((t) => r(c, {
...t,
onClick: () => a("poi-click", t.extData)
})),
r(l, {
target: e.target,
content: e.content,
offset: [0, -30],
minWidth: 150,
"onUpdate:target": (t) => a("update-target", t)
})
]);
}
});
export {
L as SearchMapView
};
//# sourceMappingURL=SearchMapView.mjs.map