1
import * as React from 'react';
2 3
import { createHostComponent } from '@remax/runtime';
3

4
export interface MapMarker {
5
  readonly dataset?: DOMStringMap;
6
  id?: number;
7
  latitude: number;
8
  longitude: number;
9
  title?: string;
10
  iconPath: string;
11
  rotate?: number;
12
  alpha?: number;
13
  width?: number;
14
  height?: number;
15
  callout?: any;
16
  anchorX?: number;
17
  anchorY?: number;
18
  customCallout?: any;
19
  iconAppendStr?: string;
20
  iconAppendStrColor?: string;
21
  fixedPoint?: any;
22
  markerLevel?: number;
23
  label?: any;
24
  style?: React.CSSProperties;
25
}
26

27
export interface MapPolyline {
28
  readonly dataset?: DOMStringMap;
29
  points: Array<{
30
    latitude: number;
31
    longitude: number;
32
  }>;
33
  color?: string;
34
  dottedLine?: boolean;
35
  iconWidth?: number;
36
  zIndex?: number;
37
  iconPath?: string;
38
  colorList?: any[];
39
  width?: number;
40
}
41

42
export interface MapCircle {
43
  readonly dataset?: DOMStringMap;
44
  latitude: number;
45
  longitude: number;
46
  color?: string;
47
  fillColor?: string;
48
  radius: number;
49
  strokeWidth?: number;
50
}
51

52
export interface MapPosition {
53
  readonly dataset?: DOMStringMap;
54
  left?: number;
55
  top?: number;
56
  width?: number;
57
  height?: number;
58
}
59

60
export interface MapControl {
61
  readonly dataset?: DOMStringMap;
62
  id?: number;
63
  position: MapPosition;
64
  iconPath: string;
65
  clickable?: boolean;
66
}
67

68
export interface MapPolygon {
69
  readonly dataset?: DOMStringMap;
70
  points: Array<{
71
    latitude: number;
72
    longitude: number;
73
  }>;
74
  color?: string;
75
  fillColor?: string;
76
  width?: number;
77
}
78

79
export interface MapCoordinate {
80
  readonly dataset?: DOMStringMap;
81
  latitude?: number;
82
  longitude?: number;
83
}
84

85
export interface MapSetting {
86
  readonly dataset?: DOMStringMap;
87
  // 手势
88
  gestureEnable?: number;
89
  // 比例尺
90
  showScale?: number;
91
  // 指南针
92
  showCompass?: number;
93
  //双手下滑
94
  tiltGesturesEnabled?: number;
95
  // 交通路况展示
96
  trafficEnabled?: number;
97
  // 地图 POI 信息
98
  showMapText?: number;
99
  // 高德地图 logo 位置
100
  logoPosition?: {
101
    centerX?: number;
102
    centerY?: number;
103
  };
104
}
105

106
export interface MapProps extends MapCoordinate {
107
  readonly dataset?: DOMStringMap;
108
  style?: React.CSSProperties;
109
  className?: string;
110
  scale?: number;
111
  markers?: MapMarker[];
112
  polyline?: MapPolyline[];
113
  circles?: MapCircle[];
114
  controls?: MapControl[];
115
  polygon?: MapPolygon[];
116
  showLocation?: boolean;
117
  includePoints?: Array<Required<MapCoordinate>>;
118
  includePadding?: { left: number; right: number; top: number; bottom: number };
119
  groundOverlays?: Array<{
120
    'include-points': Array<Required<MapCoordinate>>;
121
    image: string;
122
    alpha?: number;
123
    zIndex?: number;
124
  }>;
125
  tileOverlay?: Array<{
126
    url: string;
127
    type: number;
128
    tileWidth: number;
129
    tileHeight: number;
130
    zIndex?: number;
131
  }>;
132
  setting?: MapSetting;
133
  onMarkerTap?: (e: any) => void;
134
  onCalloutTap?: (e: any) => void;
135
  onControlTap?: (e: any) => void;
136
  onRegionChange?: (e: any) => void;
137
  onTap?: (e: any) => void;
138
}
139

140 3
export const Map = createHostComponent<MapProps>('map') as React.ComponentType<MapProps>;

Read our documentation on viewing source code .

Loading