@pusdn/pgz-comp-elep
Version:
PGZ组件库,Vue3 中基于Element-plus二次封装基础组件文档
120 lines (107 loc) • 3 kB
TypeScript
// 天地图接口类型声明文件
interface Window {
T: {
LngLat: new (lng: number | string, lat: number | string) => any;
Map: new (containerId: string) => any;
Marker: new (lnglat: any, options?: any) => any;
InfoWindow: new (content?: string, options?: any) => any;
Polyline: new (lngLats: any[], options?: any) => any;
Polygon: new (lngLats: any[], options?: any) => any;
PolygonTool: new (map: any, options?: any) => any;
Icon: new (options: any) => any;
Point: new (x: number, y: number) => any;
LocalSearch: new (map: any, options?: any) => any;
LocalCity: new () => any;
Geocoder: new () => any;
Control: {
Scale: new () => any;
Zoom: new () => any;
MapType: new () => any;
}
};
TMAP_SATELLITE_MAP: any;
TMAP_HYBRID_MAP: any;
TMAP_TERRAIN_MAP: any;
TMAP_TERRAIN_HYBRID_MAP: any;
TMAP_NORMAL_MAP: any;
T_ANCHOR_BOTTOM_RIGHT: any;
poiPicker: {
clearSearchResults: () => void;
};
}
// 扩展Element接口添加style属性
interface Element {
style: CSSStyleDeclaration;
}
declare namespace TDT {
interface LngLat {
getLng(): number;
getLat(): number;
lng: number;
lat: number;
}
interface Map {
centerAndZoom(lnglat: any, zoom: number): void;
panTo(lnglat: any): void;
clearOverLays(): void;
addOverLay(overlay: any): void;
removeOverLay(overlay: any): void;
getOverlays(): any[];
addControl(control: any): void;
disableScrollWheelZoom(): void;
zoomIn(): void;
zoomOut(): void;
setMapType(mapType: any): void;
setViewport(lnglats: any[]): void;
addEventListener(event: string, callback: (e: any) => void): void;
}
interface Marker {
openInfoWindow(infoWindow: any): void;
addEventListener(event: string, callback: (e: any) => void): void;
}
interface Polygon {
getLngLats(): LngLat[][];
addEventListener(event: string, callback: (e: any) => void): void;
}
interface PolygonTool {
open(polygon?: any): void;
close(): void;
endDraw(): void;
on(event: string, callback: (e: any) => void): void;
}
interface Geocoder {
getLocation(lnglat: any, callback: (result: any) => void): void;
}
interface LocalSearch {
search(keyword: string): void;
getCountNumber(): number;
getCountPage(): number;
getPageIndex(): number;
getResultType(): number;
firstPage(): void;
previousPage(): void;
nextPage(): void;
lastPage(): void;
gotoPage(page: number): void;
}
interface LocalCity {
location(callback: (result: any) => void): void;
}
interface SearchResult {
getResultType(): number;
getPois(): any[];
getStatistics(): any;
getArea(): any;
getSuggests(): any[];
getLineData(): any;
}
interface LocationPoint {
getLng(): number;
getLat(): number;
}
interface GeocodeResult {
getStatus(): number;
getAddress(): string;
getLocationPoint(): LocationPoint;
}
}