@tarojs/taro 3.5.0-canary.1 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/html.css +50 -14
  2. package/html5.css +167 -64
  3. package/index.js +3 -4
  4. package/package.json +21 -11
  5. package/types/api/ad/index.d.ts +2 -2
  6. package/types/api/ai/face.d.ts +133 -0
  7. package/types/api/ai/visionkit.d.ts +303 -0
  8. package/types/api/base/crypto.d.ts +90 -0
  9. package/types/api/base/debug.d.ts +152 -13
  10. package/types/api/base/env.d.ts +2 -1
  11. package/types/api/base/index.d.ts +11 -3
  12. package/types/api/base/performance.d.ts +195 -0
  13. package/types/api/base/system.d.ts +541 -103
  14. package/types/api/base/update.d.ts +60 -8
  15. package/types/api/base/weapp/app-event.d.ts +99 -37
  16. package/types/api/base/weapp/life-cycle.d.ts +142 -2
  17. package/types/api/canvas/index.d.ts +151 -137
  18. package/types/api/cloud/index.d.ts +17 -2
  19. package/types/api/data-analysis/index.d.ts +1 -1
  20. package/types/api/device/accelerometer.d.ts +6 -6
  21. package/types/api/device/accessibility.d.ts +26 -0
  22. package/types/api/device/battery.d.ts +2 -2
  23. package/types/api/device/{ble.d.ts → bluetooth-ble.d.ts} +228 -62
  24. package/types/api/device/bluetooth-peripheral.d.ts +430 -0
  25. package/types/api/device/bluetooth.d.ts +67 -2
  26. package/types/api/device/calendar.d.ts +88 -0
  27. package/types/api/device/clipboard.d.ts +2 -2
  28. package/types/api/device/compass.d.ts +3 -3
  29. package/types/api/device/contact.d.ts +74 -50
  30. package/types/api/device/gyroscope.d.ts +6 -6
  31. package/types/api/device/iBeacon.d.ts +33 -19
  32. package/types/api/{ui → device}/keyboard.d.ts +1 -1
  33. package/types/api/device/{performance.d.ts → memory.d.ts} +5 -5
  34. package/types/api/device/motion.d.ts +3 -3
  35. package/types/api/device/network.d.ts +56 -15
  36. package/types/api/device/nfc.d.ts +1089 -13
  37. package/types/api/device/phone.d.ts +1 -1
  38. package/types/api/device/scan.d.ts +1 -1
  39. package/types/api/device/screen.d.ts +42 -14
  40. package/types/api/device/vibrate.d.ts +6 -2
  41. package/types/api/device/wifi.d.ts +44 -9
  42. package/types/api/ext/index.d.ts +2 -2
  43. package/types/api/files/index.d.ts +392 -205
  44. package/types/api/framework/index.d.ts +5 -4
  45. package/types/api/location/index.d.ts +156 -53
  46. package/types/api/media/audio.d.ts +629 -38
  47. package/types/api/media/background-audio.d.ts +9 -9
  48. package/types/api/media/camera.d.ts +41 -22
  49. package/types/api/media/editor.d.ts +22 -2
  50. package/types/api/media/image.d.ts +64 -35
  51. package/types/api/media/live.d.ts +66 -6
  52. package/types/api/media/map.d.ts +474 -54
  53. package/types/api/media/media-recorder.d.ts +92 -0
  54. package/types/api/media/recorder.d.ts +21 -21
  55. package/types/api/media/video-decoder.d.ts +117 -0
  56. package/types/api/media/video-processing.d.ts +11 -7
  57. package/types/api/media/video.d.ts +47 -18
  58. package/types/api/media/voip.d.ts +290 -0
  59. package/types/api/{open-api/navigate.d.ts → navigate/index.d.ts} +65 -27
  60. package/types/api/network/download.d.ts +61 -19
  61. package/types/api/network/request.d.ts +129 -41
  62. package/types/api/network/tcp.d.ts +181 -0
  63. package/types/api/network/udp.d.ts +154 -83
  64. package/types/api/network/upload.d.ts +55 -28
  65. package/types/api/network/websocket.d.ts +20 -19
  66. package/types/api/open-api/address.d.ts +1 -1
  67. package/types/api/open-api/authorize.d.ts +42 -3
  68. package/types/api/open-api/channels.d.ts +178 -0
  69. package/types/api/open-api/facial.d.ts +3 -0
  70. package/types/api/open-api/favorites.d.ts +100 -0
  71. package/types/api/open-api/group.d.ts +59 -0
  72. package/types/api/open-api/invoice.d.ts +2 -2
  73. package/types/api/open-api/license-plate.d.ts +27 -0
  74. package/types/api/open-api/login.d.ts +21 -0
  75. package/types/api/open-api/redpackage.d.ts +24 -0
  76. package/types/api/open-api/settings.d.ts +82 -17
  77. package/types/api/open-api/soter.d.ts +2 -2
  78. package/types/api/open-api/subscribe-message.d.ts +89 -4
  79. package/types/api/open-api/user-info.d.ts +56 -19
  80. package/types/api/open-api/werun.d.ts +33 -6
  81. package/types/api/payment/index.d.ts +119 -0
  82. package/types/api/route/index.d.ts +18 -14
  83. package/types/api/share/index.d.ts +192 -9
  84. package/types/api/storage/index.d.ts +38 -92
  85. package/types/api/swan/index.d.ts +1 -1
  86. package/types/api/ui/animation.d.ts +105 -155
  87. package/types/api/ui/background.d.ts +4 -2
  88. package/types/api/ui/custom-component.d.ts +1 -1
  89. package/types/api/ui/fonts.d.ts +27 -31
  90. package/types/api/ui/interaction.d.ts +6 -6
  91. package/types/api/ui/menu.d.ts +1 -1
  92. package/types/api/ui/navigation-bar.d.ts +6 -5
  93. package/types/api/ui/pull-down-refresh.d.ts +2 -2
  94. package/types/api/ui/scroll.d.ts +75 -7
  95. package/types/api/ui/sticky.d.ts +4 -4
  96. package/types/api/ui/tab-bar.d.ts +8 -8
  97. package/types/api/ui/window.d.ts +22 -2
  98. package/types/api/worker/index.d.ts +9 -1
  99. package/types/api/wxml/index.d.ts +116 -112
  100. package/types/compile.d.ts +57 -6
  101. package/types/global.d.ts +142 -111
  102. package/types/taro.api.d.ts +79 -62
  103. package/types/taro.component.d.ts +21 -65
  104. package/types/taro.config.d.ts +31 -0
  105. package/types/taro.extend.d.ts +31 -18
  106. package/types/taro.hooks.d.ts +55 -3
  107. package/types/taro.lifecycle.d.ts +21 -14
  108. package/LICENSE +0 -21
  109. package/types/api/open-api/payment.d.ts +0 -61
@@ -1,50 +1,187 @@
1
+ import { MapProps } from '@tarojs/components';
1
2
  import Taro from '../../index'
2
3
 
3
4
  declare module '../../index' {
4
- /** `MapContext` 实例,可通过 Taro.createMapContext 获取。
5
+ /** `MapContext` 实例,可通过 [Taro.createMapContext](./createMapContext) 获取。
5
6
  * `MapContext` 通过 id 跟一个 map 组件绑定,操作对应的 map 组件。
7
+ * @supported weapp, tt
8
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.html
6
9
  */
7
10
  interface MapContext {
8
- /** 获取当前地图中心的经纬度。返回的是 gcj02 坐标系,可以用于 [wx.openLocation()](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.openLocation.html)
9
- * @supported weapp
11
+ /** 获取当前地图中心的经纬度。返回的是 gcj02 坐标系,可以用于 [Taro.openLocation()](/docs/apis/location/openLocation)
12
+ * @supported weapp, tt
10
13
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getCenterLocation.html
11
14
  */
12
15
  getCenterLocation(option?: MapContext.GetCenterLocationOption): Promise<MapContext.GetCenterLocationSuccessCallbackResult>
16
+
17
+ /** 设置定位点图标,支持网络路径、本地路径、代码包路径
18
+ * @supported weapp, tt
19
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.setLocMarkerIcon.html
20
+ */
21
+ setLocMarkerIcon(option?: MapContext.SetLocMarkerIconOption): Promise<TaroGeneral.CallbackResult>
22
+
23
+ /** 将地图中心移置当前定位点,此时需设置地图组件 show-location 为true。
24
+ * @supported weapp, tt
25
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.moveToLocation.html
26
+ */
27
+ moveToLocation(option: MapContext.MoveToLocationOption): Promise<TaroGeneral.CallbackResult>
28
+
29
+ /** 平移marker,带动画
30
+ * @supported weapp, tt
31
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.translateMarker.html
32
+ */
33
+ translateMarker(option: MapContext.TranslateMarkerOption): Promise<TaroGeneral.CallbackResult>
34
+
35
+ /** 沿指定路径移动 marker,用于轨迹回放等场景。动画完成时触发回调事件,若动画进行中,对同一 marker 再次调用 moveAlong 方法,前一次的动画将被打断。 */
36
+ moveAlong(object)
37
+
38
+ /** 缩放视野展示所有经纬度
39
+ * @supported weapp, tt
40
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.includePoints.html
41
+ */
42
+ includePoints(option: MapContext.IncludePointsOption): Promise<TaroGeneral.CallbackResult>
43
+
13
44
  /** 获取当前地图的视野范围
14
- * @supported weapp
45
+ * @supported weapp, tt
15
46
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getRegion.html
16
47
  */
17
48
  getRegion(option?: MapContext.GetRegionOption): Promise<MapContext.GetRegionSuccessCallbackResult>
49
+
18
50
  /** 获取当前地图的旋转角
19
- * @supported weapp
51
+ * @supported weapp, tt
20
52
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getRotate.html
21
53
  */
22
54
  getRotate(option?: MapContext.GetRotateOption): Promise<MapContext.GetRotateSuccessCallbackResult>
55
+
56
+ /** 获取当前地图的倾斜角
57
+ * @supported weapp, tt
58
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getSkew.html
59
+ */
60
+ getSkew(option?: MapContext.GetSkewOption): Promise<MapContext.GetSkewSuccessCallbackResult>
61
+
23
62
  /** 获取当前地图的缩放级别
24
- * @supported weapp
63
+ * @supported weapp, tt
25
64
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getScale.html
26
65
  */
27
66
  getScale(option?: MapContext.GetScaleOption): Promise<MapContext.GetScaleSuccessCallbackResult>
28
- /** 获取当前地图的倾斜角
67
+
68
+ /** 设置地图中心点偏移,向后向下为增长,屏幕比例范围(0.25~0.75),默认偏移为[0.5, 0.5]
69
+ * @supported weapp, tt
70
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.setCenterOffset.html
71
+ */
72
+ setCenterOffset(option: MapContext.SetCenterOffsetOption): Promise<TaroGeneral.CallbackResult>
73
+
74
+ /** 移除个性化图层。
29
75
  * @supported weapp
30
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getSkew.html
76
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeCustomLayer.html
31
77
  */
32
- getSkew(option?: MapContext.GetSkewOption): Promise<MapContext.GetSkewSuccessCallbackResult>
33
- /** 缩放视野展示所有经纬度
78
+ removeCustomLayer(option: MapContext.RemoveCustomLayerOption): Promise<TaroGeneral.CallbackResult>
79
+
80
+ /** 添加个性化图层。图层创建参考文档
34
81
  * @supported weapp
35
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.includePoints.html
82
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addCustomLayer.html
36
83
  */
37
- includePoints(option: MapContext.IncludePointsOption): Promise<TaroGeneral.CallbackResult>
38
- /** 将地图中心移置当前定位点,此时需设置地图组件 show-location 为true。
84
+ addCustomLayer(option: MapContext.AddCustomLayerOption): Promise<TaroGeneral.CallbackResult>
85
+
86
+ /** 创建自定义图片图层,图片会随着地图缩放而缩放。
87
+ * @supported weapp, tt
88
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addGroundOverlay.html
89
+ */
90
+ addGroundOverlay(option: MapContext.AddGroundLayerOption): Promise<TaroGeneral.CallbackResult>
91
+
92
+ /** 添加可视化图层。需要刷新时,interval 可设置的最小值为 15 s。
39
93
  * @supported weapp
40
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.moveToLocation.html
94
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addVisualLayer.html
41
95
  */
42
- moveToLocation(option: MapContext.MoveToLocationOption): Promise<TaroGeneral.CallbackResult>
43
- /** 平移marker,带动画
96
+ addVisualLayer(option: MapContext.AddVisualLayerOption): Promise<TaroGeneral.CallbackResult>
97
+
98
+ /** 移除可视化图层。
44
99
  * @supported weapp
45
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.translateMarker.html
100
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeVisualLayer.html
46
101
  */
47
- translateMarker(option: MapContext.TranslateMarkerOption): Promise<TaroGeneral.CallbackResult>
102
+ removeVisualLayer(option: MapContext.RemoveVisualLayerOption): Promise<TaroGeneral.CallbackResult>
103
+
104
+ /** 添加弧线,途经点与夹角必须设置一个。途经点必须在起终点有效坐标范围内,否则不能生成正确的弧线,同时设置夹角角度时,以夹角角度为准。夹角定义为起点到终点,与起点外切线逆时针旋转的角度。
105
+ * @supported weapp
106
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addArc.html
107
+ */
108
+ addArc(option: MapContext.AddArcOption): Promise<TaroGeneral.CallbackResult>
109
+
110
+ /** 删除弧线。
111
+ * @supported weapp
112
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeArc.html
113
+ */
114
+ removeArc(option: MapContext.RemoveArcOption): Promise<TaroGeneral.CallbackResult>
115
+
116
+ /** 限制地图的显示范围。此接口同时会限制地图的最小缩放整数级别。
117
+ * @supported weapp
118
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.setBoundary.html
119
+ */
120
+ setBoundary(option: MapContext.SetBoundaryOption): Promise<TaroGeneral.CallbackResult>
121
+
122
+ /** 更新自定义图片图层。
123
+ * @supported weapp, tt
124
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.updateGroundOverlay.html
125
+ */
126
+ updateGroundOverlay(option: MapContext.UpdateGroundOverlayOption): Promise<TaroGeneral.CallbackResult>
127
+
128
+ /** 移除自定义图片图层。
129
+ * @supported weapp, tt
130
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeGroundOverlay.html
131
+ */
132
+ removeGroundOverlay(option: MapContext.RemoveGroundOverlayOption): Promise<TaroGeneral.CallbackResult>
133
+
134
+ /** 获取经纬度对应的屏幕坐标,坐标原点为地图左上角。
135
+ * @supported weapp
136
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.toScreenLocation.html
137
+ */
138
+ toScreenLocation(option: MapContext.ToScreenLocationOption): Promise<TaroGeneral.CallbackResult>
139
+
140
+ /** 获取屏幕上的点对应的经纬度,坐标原点为地图左上角。
141
+ * @supported weapp
142
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.fromScreenLocation.html
143
+ */
144
+ fromScreenLocation(option: MapContext.FromScreenLocationOption): Promise<TaroGeneral.CallbackResult>
145
+
146
+ /** 拉起地图APP选择导航。
147
+ * @supported weapp
148
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.openMapApp.html
149
+ */
150
+ openMapApp(option: MapContext.OpenMapAppOption): Promise<TaroGeneral.CallbackResult>
151
+
152
+ /** 添加 marker。
153
+ * @supported weapp
154
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addMarkers.html
155
+ */
156
+ addMarkers(option: MapContext.AddMarkersOption): Promise<TaroGeneral.CallbackResult>
157
+
158
+ /** 移除 marker。
159
+ * @supported weapp
160
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeMarkers.html
161
+ */
162
+ removeMarkers(option: MapContext.RemoveMarkersOption): Promise<TaroGeneral.CallbackResult>
163
+
164
+ /** 初始化点聚合的配置,未调用时采用默认配置。
165
+ * @supported weapp
166
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.initMarkerCluster.html
167
+ */
168
+ initMarkerCluster(option?: MapContext.InitMarkerClusterOption): Promise<TaroGeneral.CallbackResult>
169
+
170
+ /** 监听地图事件。
171
+ * @supported weapp
172
+ * @example
173
+ * ```tsx
174
+ * MapContext.on('markerClusterCreate', (res) => {})
175
+ * MapContext.on('markerClusterClick', (res) => {})
176
+ * ```
177
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.on.html
178
+ */
179
+ on(
180
+ /** 事件名 */
181
+ event: keyof MapContext.MapEvent,
182
+ /** 事件的回调函数 */
183
+ callback: (res: MapContext.MapEvent[keyof MapContext.MapEvent]) => void
184
+ ): void
48
185
  }
49
186
  namespace MapContext {
50
187
  interface GetCenterLocationOption {
@@ -53,12 +190,10 @@ declare module '../../index' {
53
190
  /** 接口调用失败的回调函数 */
54
191
  fail?: (res: TaroGeneral.CallbackResult) => void
55
192
  /** 接口调用成功的回调函数 */
56
- success?: GetCenterLocationSuccessCallback
193
+ success?: (
194
+ result: GetCenterLocationSuccessCallbackResult,
195
+ ) => void
57
196
  }
58
- /** 接口调用成功的回调函数 */
59
- type GetCenterLocationSuccessCallback = (
60
- result: GetCenterLocationSuccessCallbackResult,
61
- ) => void
62
197
  interface GetCenterLocationSuccessCallbackResult extends TaroGeneral.CallbackResult {
63
198
  /** 纬度 */
64
199
  latitude: number
@@ -67,25 +202,31 @@ declare module '../../index' {
67
202
  /** 调用结果 */
68
203
  errMsg: string
69
204
  }
205
+ interface SetLocMarkerIconOption {
206
+ /** 图标路径,支持网络路径、本地路径、代码包路径 */
207
+ iconPath: string
208
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
209
+ complete?: (res: TaroGeneral.CallbackResult) => void
210
+ /** 接口调用失败的回调函数 */
211
+ fail?: (res: TaroGeneral.CallbackResult) => void
212
+ /** 接口调用成功的回调函数 */
213
+ success?: (res: TaroGeneral.CallbackResult) => void
214
+ }
70
215
  interface GetRegionOption {
71
216
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
72
217
  complete?: (res: TaroGeneral.CallbackResult) => void
73
218
  /** 接口调用失败的回调函数 */
74
219
  fail?: (res: TaroGeneral.CallbackResult) => void
75
220
  /** 接口调用成功的回调函数 */
76
- success?: GetRegionSuccessCallback
221
+ success?: (
222
+ result: GetRegionSuccessCallbackResult,
223
+ ) => void
77
224
  }
78
- /** 接口调用成功的回调函数 */
79
- type GetRegionSuccessCallback = (
80
- result: GetRegionSuccessCallbackResult,
81
- ) => void
82
225
  interface GetRegionSuccessCallbackResult extends TaroGeneral.CallbackResult {
83
226
  /** 东北角经纬度 */
84
- northeast: MapPostion
227
+ northeast: MapPosition
85
228
  /** 西南角经纬度 */
86
- southwest: MapPostion
87
- /** 调用结果 */
88
- errMsg: string
229
+ southwest: MapPosition
89
230
  }
90
231
  interface GetRotateOption {
91
232
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
@@ -93,12 +234,10 @@ declare module '../../index' {
93
234
  /** 接口调用失败的回调函数 */
94
235
  fail?: (res: TaroGeneral.CallbackResult) => void
95
236
  /** 接口调用成功的回调函数 */
96
- success?: GetRotateSuccessCallback
237
+ success?: (
238
+ result: GetRotateSuccessCallbackResult,
239
+ ) => void
97
240
  }
98
- /** 接口调用成功的回调函数 */
99
- type GetRotateSuccessCallback = (
100
- result: GetRotateSuccessCallbackResult,
101
- ) => void
102
241
  interface GetRotateSuccessCallbackResult extends TaroGeneral.CallbackResult {
103
242
  /** 旋转角 */
104
243
  rotate: number
@@ -111,12 +250,10 @@ declare module '../../index' {
111
250
  /** 接口调用失败的回调函数 */
112
251
  fail?: (res: TaroGeneral.CallbackResult) => void
113
252
  /** 接口调用成功的回调函数 */
114
- success?: GetScaleSuccessCallback
253
+ success?: (
254
+ result: GetScaleSuccessCallbackResult,
255
+ ) => void
115
256
  }
116
- /** 接口调用成功的回调函数 */
117
- type GetScaleSuccessCallback = (
118
- result: GetScaleSuccessCallbackResult,
119
- ) => void
120
257
  interface GetScaleSuccessCallbackResult extends TaroGeneral.CallbackResult {
121
258
  /** 缩放值 */
122
259
  scale: number
@@ -129,10 +266,8 @@ declare module '../../index' {
129
266
  /** 接口调用失败的回调函数 */
130
267
  fail?: (res: TaroGeneral.CallbackResult) => void
131
268
  /** 接口调用成功的回调函数 */
132
- success?: GetSkewSuccessCallback
269
+ success?: (result: GetSkewSuccessCallbackResult) => void
133
270
  }
134
- /** 接口调用成功的回调函数 */
135
- type GetSkewSuccessCallback = (result: GetSkewSuccessCallbackResult) => void
136
271
  interface GetSkewSuccessCallbackResult extends TaroGeneral.CallbackResult {
137
272
  /** 倾斜角 */
138
273
  skew: number
@@ -141,7 +276,7 @@ declare module '../../index' {
141
276
  }
142
277
  interface IncludePointsOption {
143
278
  /** 要显示在可视区域内的坐标点列表 */
144
- points: MapPostion[]
279
+ points: MapPosition[]
145
280
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
146
281
  complete?: (res: TaroGeneral.CallbackResult) => void
147
282
  /** 接口调用失败的回调函数 */
@@ -151,13 +286,20 @@ declare module '../../index' {
151
286
  /** 接口调用成功的回调函数 */
152
287
  success?: (res: TaroGeneral.CallbackResult) => void
153
288
  }
154
- /** 要显示在可视区域内的坐标点列表 */
155
- interface MapPostion {
289
+ /** 坐标点 */
290
+ interface MapPosition {
156
291
  /** 纬度 */
157
292
  latitude: number
158
293
  /** 经度 */
159
294
  longitude: number
160
295
  }
296
+ /** 经纬度范围 */
297
+ interface MapBoundary {
298
+ /** 西南角经纬度 */
299
+ southwest: MapPosition
300
+ /** 东北角经纬度 */
301
+ northeast: MapPosition
302
+ }
161
303
  interface MoveToLocationOption {
162
304
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
163
305
  complete?: (res: TaroGeneral.CallbackResult) => void
@@ -174,7 +316,7 @@ declare module '../../index' {
174
316
  /** 移动过程中是否自动旋转 marker */
175
317
  autoRotate: boolean
176
318
  /** 指定 marker 移动到的目标点 */
177
- destination: DestinationOption
319
+ destination: MapPosition
178
320
  /** 指定 marker */
179
321
  markerId: number
180
322
  /** marker 的旋转角度 */
@@ -189,19 +331,297 @@ declare module '../../index' {
189
331
  fail?: (res: TaroGeneral.CallbackResult) => void
190
332
  /** 接口调用成功的回调函数 */
191
333
  success?: (res: TaroGeneral.CallbackResult) => void
192
- } /** 指定 marker 移动到的目标点 */
193
- interface DestinationOption {
334
+ }
335
+ interface SetCenterOffsetOption {
336
+ /** 偏移量,两位数组 */
337
+ offset: number[]
338
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
339
+ complete?: (res: TaroGeneral.CallbackResult) => void
340
+ /** 接口调用失败的回调函数 */
341
+ fail?: (res: TaroGeneral.CallbackResult) => void
342
+ /** 接口调用成功的回调函数 */
343
+ success?: (res: TaroGeneral.CallbackResult) => void
344
+ }
345
+ interface RemoveCustomLayerOption {
346
+ /** 个性化图层id */
347
+ layerId: number
348
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
349
+ complete?: (res: TaroGeneral.CallbackResult) => void
350
+ /** 接口调用失败的回调函数 */
351
+ fail?: (res: TaroGeneral.CallbackResult) => void
352
+ /** 接口调用成功的回调函数 */
353
+ success?: (res: TaroGeneral.CallbackResult) => void
354
+ }
355
+ interface AddCustomLayerOption {
356
+ /** 个性化图层id */
357
+ layerId: number
358
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
359
+ complete?: (res: TaroGeneral.CallbackResult) => void
360
+ /** 接口调用失败的回调函数 */
361
+ fail?: (res: TaroGeneral.CallbackResult) => void
362
+ /** 接口调用成功的回调函数 */
363
+ success?: (res: TaroGeneral.CallbackResult) => void
364
+ }
365
+ interface AddGroundLayerOption {
366
+ /** 图片图层 id */
367
+ id: number
368
+ /** 图片路径,支持网络图片、临时路径、代码包路径 */
369
+ src: string
370
+ /** 图片覆盖的经纬度范围 */
371
+ bounds: MapBoundary
372
+ /** 是否可见
373
+ * @default true
374
+ */
375
+ visible?: boolean
376
+ /** 图层绘制顺序
377
+ * @default 1
378
+ */
379
+ zIndex?: number
380
+ /** 图层透明度
381
+ * @default 1
382
+ */
383
+ opacity?: number
384
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
385
+ complete?: (res: TaroGeneral.CallbackResult) => void
386
+ /** 接口调用失败的回调函数 */
387
+ fail?: (res: TaroGeneral.CallbackResult) => void
388
+ /** 接口调用成功的回调函数 */
389
+ success?: (res: TaroGeneral.CallbackResult) => void
390
+ }
391
+ interface AddVisualLayerOption {
392
+ /** 个性化图层id([创建图层指引](https://lbs.qq.com/dev/console/layers/layerEdit)) */
393
+ layerId: number
394
+ /** 刷新周期,单位秒
395
+ * @default 0
396
+ */
397
+ interval?: number
398
+ /** 图层绘制顺序
399
+ * @default 1
400
+ */
401
+ zIndex?: number
402
+ /** 图层透明度
403
+ * @default 1
404
+ */
405
+ opacity?: number
406
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
407
+ complete?: (res: TaroGeneral.CallbackResult) => void
408
+ /** 接口调用失败的回调函数 */
409
+ fail?: (res: TaroGeneral.CallbackResult) => void
410
+ /** 接口调用成功的回调函数 */
411
+ success?: (res: TaroGeneral.CallbackResult) => void
412
+ }
413
+ interface RemoveVisualLayerOption {
414
+ /** 可视化图层 id */
415
+ layerId: number
416
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
417
+ complete?: (res: TaroGeneral.CallbackResult) => void
418
+ /** 接口调用失败的回调函数 */
419
+ fail?: (res: TaroGeneral.CallbackResult) => void
420
+ /** 接口调用成功的回调函数 */
421
+ success?: (res: TaroGeneral.CallbackResult) => void
422
+ }
423
+ interface AddArcOption {
424
+ /** 圆弧 id */
425
+ id: number
426
+ /** 起始点 */
427
+ start: MapPosition
428
+ /** 终点 */
429
+ end: MapPosition
430
+ /** 途经点 */
431
+ pass?: MapPosition
432
+ /** 夹角角度
433
+ * @default 0
434
+ */
435
+ angle?: number
436
+ /** 线宽
437
+ * @default 5
438
+ */
439
+ width?: number
440
+ /** 线的颜色
441
+ * @default "#000000"
442
+ */
443
+ color?: string
444
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
445
+ complete?: (res: TaroGeneral.CallbackResult) => void
446
+ /** 接口调用失败的回调函数 */
447
+ fail?: (res: TaroGeneral.CallbackResult) => void
448
+ /** 接口调用成功的回调函数 */
449
+ success?: (res: TaroGeneral.CallbackResult) => void
450
+ }
451
+ interface RemoveArcOption {
452
+ /** 圆弧 id */
453
+ id: number
454
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
455
+ complete?: (res: TaroGeneral.CallbackResult) => void
456
+ /** 接口调用失败的回调函数 */
457
+ fail?: (res: TaroGeneral.CallbackResult) => void
458
+ /** 接口调用成功的回调函数 */
459
+ success?: (res: TaroGeneral.CallbackResult) => void
460
+ }
461
+ interface SetBoundaryOption {
462
+ /** 西南角经纬度 */
463
+ southwest: MapPosition
464
+ /** 东北角经纬度 */
465
+ northeast: MapPosition
466
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
467
+ complete?: (res: TaroGeneral.CallbackResult) => void
468
+ /** 接口调用失败的回调函数 */
469
+ fail?: (res: TaroGeneral.CallbackResult) => void
470
+ /** 接口调用成功的回调函数 */
471
+ success?: (res: TaroGeneral.CallbackResult) => void
472
+ }
473
+ interface UpdateGroundOverlayOption {
474
+ /** 图片图层 id */
475
+ id: number
476
+ /** 图片路径,支持网络图片、临时路径、代码包路径 */
477
+ src: string
478
+ /** 图片覆盖的经纬度范围 */
479
+ bounds: MapBoundary
480
+ /** 是否可见
481
+ * @default true
482
+ */
483
+ visible?: boolean
484
+ /** 图层绘制顺序
485
+ * @default 1
486
+ */
487
+ zIndex?: number
488
+ /** 图层透明度
489
+ * @default 1
490
+ */
491
+ opacity?: number
492
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
493
+ complete?: (res: TaroGeneral.CallbackResult) => void
494
+ /** 接口调用失败的回调函数 */
495
+ fail?: (res: TaroGeneral.CallbackResult) => void
496
+ /** 接口调用成功的回调函数 */
497
+ success?: (res: TaroGeneral.CallbackResult) => void
498
+ }
499
+ interface RemoveGroundOverlayOption {
500
+ /** 图片图层 id */
501
+ id: number
502
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
503
+ complete?: (res: TaroGeneral.CallbackResult) => void
504
+ /** 接口调用失败的回调函数 */
505
+ fail?: (res: TaroGeneral.CallbackResult) => void
506
+ /** 接口调用成功的回调函数 */
507
+ success?: (res: TaroGeneral.CallbackResult) => void
508
+ }
509
+ interface ToScreenLocationOption {
194
510
  /** 纬度 */
195
511
  latitude: number
196
512
  /** 经度 */
197
513
  longitude: number
514
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
515
+ complete?: (res: TaroGeneral.CallbackResult) => void
516
+ /** 接口调用失败的回调函数 */
517
+ fail?: (res: TaroGeneral.CallbackResult) => void
518
+ /** 接口调用成功的回调函数 */
519
+ success?: (res: TaroGeneral.CallbackResult) => void
520
+ }
521
+ interface FromScreenLocationOption {
522
+ /** x 坐标值 */
523
+ x: number
524
+ /** y 坐标值 */
525
+ y: number
526
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
527
+ complete?: (res: TaroGeneral.CallbackResult) => void
528
+ /** 接口调用失败的回调函数 */
529
+ fail?: (res: TaroGeneral.CallbackResult) => void
530
+ /** 接口调用成功的回调函数 */
531
+ success?: (res: TaroGeneral.CallbackResult) => void
532
+ }
533
+ interface OpenMapAppOption {
534
+ /** 目的地经度 */
535
+ longitude: number
536
+ /** 目的地纬度 */
537
+ latitude: number
538
+ /** 目的地名称 */
539
+ destination: string
540
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
541
+ complete?: (res: TaroGeneral.CallbackResult) => void
542
+ /** 接口调用失败的回调函数 */
543
+ fail?: (res: TaroGeneral.CallbackResult) => void
544
+ /** 接口调用成功的回调函数 */
545
+ success?: (res: TaroGeneral.CallbackResult) => void
546
+ }
547
+ interface AddMarkersOption {
548
+ /** 同传入 map 组件的 marker 属性 */
549
+ markers: MapProps.marker[]
550
+ /** 是否先清空地图上所有 marker
551
+ * @default false
552
+ */
553
+ clear?: boolean
554
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
555
+ complete?: (res: TaroGeneral.CallbackResult) => void
556
+ /** 接口调用失败的回调函数 */
557
+ fail?: (res: TaroGeneral.CallbackResult) => void
558
+ /** 接口调用成功的回调函数 */
559
+ success?: (res: TaroGeneral.CallbackResult) => void
560
+ }
561
+ interface RemoveMarkersOption {
562
+ /** marker 的 id 集合。 */
563
+ markerIds: string[]
564
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
565
+ complete?: (res: TaroGeneral.CallbackResult) => void
566
+ /** 接口调用失败的回调函数 */
567
+ fail?: (res: TaroGeneral.CallbackResult) => void
568
+ /** 接口调用成功的回调函数 */
569
+ success?: (res: TaroGeneral.CallbackResult) => void
570
+ }
571
+ interface InitMarkerClusterOption {
572
+ /** 启用默认的聚合样式
573
+ * @default true
574
+ */
575
+ enableDefaultStyle?: boolean
576
+ /** 点击已经聚合的标记点时是否实现聚合分离
577
+ * @default true
578
+ */
579
+ zoomOnClick?: boolean
580
+ /** 聚合算法的可聚合距离,即距离小于该值的点会聚合至一起,以像素为单位
581
+ * @default 60
582
+ */
583
+ gridSize?: number
584
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
585
+ complete?: (res: TaroGeneral.CallbackResult) => void
586
+ /** 接口调用失败的回调函数 */
587
+ fail?: (res: TaroGeneral.CallbackResult) => void
588
+ /** 接口调用成功的回调函数 */
589
+ success?: (res: TaroGeneral.CallbackResult) => void
590
+ }
591
+ /** event 的合法值 */
592
+ interface MapEvent {
593
+ /** 缩放或拖动导致新的聚合簇产生时触发,仅返回新创建的聚合簇信息 */
594
+ markerClusterCreate: MapEventMarkerClusterCreate
595
+ /** 聚合簇的点击事件 */
596
+ markerClusterClick: MapEventMarkerClusterClick
597
+ }
598
+ interface MapEventMarkerClusterCreate {
599
+ /** 聚合簇数据 */
600
+ clusters: ClusterInfo[]
601
+ }
602
+ interface MapEventMarkerClusterClick {
603
+ /** 聚合簇 */
604
+ cluster: ClusterInfo
605
+ }
606
+ interface ClusterInfo {
607
+ /** 聚合簇的 id */
608
+ clusterId: number
609
+ /** 聚合簇的坐标 */
610
+ center: LatLng
611
+ /** 该聚合簇内的点标记数据数组 */
612
+ markerIds: string[]
613
+ }
614
+ interface LatLng {
615
+ /** 纬度值 */
616
+ lat: number
617
+ /** 经度值 */
618
+ lng: number
198
619
  }
199
620
  }
200
621
 
201
622
  interface TaroStatic {
202
- /**
203
- * 创建 [map](https://developers.weixin.qq.com/miniprogram/dev/component/map.html) 上下文 [MapContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.html) 对象。
204
- * @supported weapp
623
+ /** 创建 [map](/docs/components/maps/map) 上下文 [MapContext](/docs/apis/media/map/MapContext) 对象。
624
+ * @supported weapp, tt
205
625
  * @example
206
626
  * ```tsx
207
627
  * const mapCtx = Taro.createMapContext('myMap')