vue-tianditu2
Version:
39 lines (38 loc) • 1.48 kB
JavaScript
import { toLonLatNumberArray as m, toLngLat as y } from "../../../utils/converter.mjs";
import { debounce as h } from "../../../utils/tool.mjs";
function C(o, e) {
function i(n = o.queryType, r = o.keyword, c = 0) {
var l, a, u;
o.queryType = n, o.keyword = r, o.current = 1, (l = o.localSearch) == null || l.setSpecifyAdminCode(c), o.keyword ? (a = o.localSearch) == null || a.search(o.keyword, o.queryType) : ((u = o.localSearch) == null || u.clearResults(), o.target = null, o.pois = !1, o.statistics = !1, o.area = !1, o.suggests = !1, o.prompt = !1, o.lineData = !1);
}
function p(n) {
o.target = null, o.pois = n.pois, o.statistics = n.statistics, o.area = n.area, o.suggests = n.suggests, o.prompt = n.prompt, o.lineData = n.lineData, o.total = Number(n.count), e("search-complete", n);
}
function g(n) {
var c;
const r = m(n.lonlat);
(c = o.tdtMap) == null || c.panTo(y(r)), o.target = r, o.content = `
<strong>${n.name}</strong>
<div>地址:${n.address}</div>
<div>坐标:${n.lonlat}</div>
`, e("poi-click", n);
}
function d(n) {
i(1, n.name, Number(n.gbCode)), e("suggest-click", n);
}
function f(n) {
var r;
o.current = n.current || 1, (r = o.localSearch) == null || r.gotoPage(o.current);
}
return {
onSearch: h(i, 100),
onSearchComplete: p,
onPoiClick: g,
onSuggestClick: d,
onPageChange: f
};
}
export {
C as useMethods
};
//# sourceMappingURL=methods.mjs.map