@tarojs/taro 3.6.18 → 3.6.19
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.
- package/package.json +4 -4
- package/types/api/data-analysis/index.d.ts +51 -1
- package/types/api/files/index.d.ts +71 -41
- package/types/api/location/index.d.ts +166 -18
- package/types/api/media/camera.d.ts +6 -3
- package/types/api/storage/background-fetch.d.ts +63 -11
- package/types/api/storage/cache-manager.d.ts +51 -0
- package/types/api/storage/index.d.ts +125 -10
- package/types/api/ui/fonts.d.ts +4 -3
- package/types/compile/config/h5.d.ts +3 -0
- package/types/compile/config/mini.d.ts +11 -8
- package/types/taro.config.d.ts +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/taro",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.19",
|
|
4
4
|
"description": "Taro framework",
|
|
5
5
|
"homepage": "https://github.com/nervjs/taro/tree/master/packages/taro#readme",
|
|
6
6
|
"main": "index.js",
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"author": "O2Team",
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@tarojs/api": "3.6.
|
|
25
|
-
"@tarojs/runtime": "3.6.
|
|
24
|
+
"@tarojs/api": "3.6.19",
|
|
25
|
+
"@tarojs/runtime": "3.6.19"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@tarojs/helper": "3.6.
|
|
28
|
+
"@tarojs/helper": "3.6.19"
|
|
29
29
|
},
|
|
30
30
|
"peerDependenciesMeta": {
|
|
31
31
|
"@types/react": {
|
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
import Taro from '../../index'
|
|
2
2
|
|
|
3
3
|
declare module '../../index' {
|
|
4
|
+
namespace getCommonConfig {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 需要获取的数据指标的对象数组,每个string的格式约定:配置类型_分表key */
|
|
7
|
+
keys?: string[]
|
|
8
|
+
/** 0:通用配置模式 1:实验模式, 参数与返回结果的使用等效于接口wx.getExptInfoSync */
|
|
9
|
+
mode: 0 | 1
|
|
10
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
11
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
12
|
+
/** 接口调用失败的回调函数 */
|
|
13
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
14
|
+
/** 接口调用成功的回调函数 */
|
|
15
|
+
success?: (res: SuccessCallbackResult) => void
|
|
16
|
+
}
|
|
17
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
18
|
+
/** 错误码 */
|
|
19
|
+
errcode: number
|
|
20
|
+
/** 错误信息 */
|
|
21
|
+
errmsg: string
|
|
22
|
+
/** 配置类型, 1-表类型 2-kv类型 */
|
|
23
|
+
conf_type: number
|
|
24
|
+
/** 根据conf_type来确定conf内容, conf_type为1时conf是一个json数组, 类似"[{xxx},{xxx}]", 每一项对应表类型每一行配置内容, 其中conf_type为2时conf是一个json对象,类似"{xxxx}" */
|
|
25
|
+
conf: string
|
|
26
|
+
/** 过期时间,单位秒. 0表示当次有效 */
|
|
27
|
+
expire_sec: number
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
4
31
|
interface TaroStatic {
|
|
5
32
|
/** 自定义业务数据监控上报接口。
|
|
6
33
|
*
|
|
@@ -21,7 +48,7 @@ declare module '../../index' {
|
|
|
21
48
|
): void
|
|
22
49
|
|
|
23
50
|
/** 自定义分析数据上报接口。使用前,需要在小程序管理后台自定义分析中新建事件,配置好事件名与字段。
|
|
24
|
-
* @supported weapp, tt
|
|
51
|
+
* @supported weapp, swan, tt
|
|
25
52
|
* @example
|
|
26
53
|
* ```tsx
|
|
27
54
|
* Taro.reportAnalytics('purchase', {
|
|
@@ -68,5 +95,28 @@ declare module '../../index' {
|
|
|
68
95
|
/** 实验参数数组,不填则获取所有实验参数 */
|
|
69
96
|
keys?: Array<string>
|
|
70
97
|
): TaroGeneral.IAnyObject
|
|
98
|
+
|
|
99
|
+
/** 给定实验参数数组,获取对应的实验参数值
|
|
100
|
+
* @supported weapp
|
|
101
|
+
* @example
|
|
102
|
+
* ```tsx
|
|
103
|
+
* Taro.getCommonConfig({
|
|
104
|
+
* keys:["key1", "key2"],
|
|
105
|
+
* mode: 0,
|
|
106
|
+
* success: (res) => {
|
|
107
|
+
* console.log("success")
|
|
108
|
+
* console.log(res)
|
|
109
|
+
* },
|
|
110
|
+
* fail: (res) => {
|
|
111
|
+
* console.log("fail")
|
|
112
|
+
* console.log(res)
|
|
113
|
+
* }
|
|
114
|
+
* })
|
|
115
|
+
* ```
|
|
116
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/data-analysis/wx.getCommonConfig.html
|
|
117
|
+
*/
|
|
118
|
+
getCommonConfig(
|
|
119
|
+
option: getCommonConfig.Option
|
|
120
|
+
): Promise<getCommonConfig.SuccessCallbackResult>
|
|
71
121
|
}
|
|
72
122
|
}
|
|
@@ -24,6 +24,10 @@ declare module '../../index' {
|
|
|
24
24
|
fail?: (result: FailCallbackResult) => void
|
|
25
25
|
/** 要存储的文件路径 */
|
|
26
26
|
filePath?: string
|
|
27
|
+
/** 要保存的本地临时文件路径
|
|
28
|
+
* @supported alipay
|
|
29
|
+
*/
|
|
30
|
+
apFilePath: string
|
|
27
31
|
/** 接口调用成功的回调函数 */
|
|
28
32
|
success?: (result: SuccessCallbackResult) => void
|
|
29
33
|
}
|
|
@@ -120,6 +124,10 @@ declare module '../../index' {
|
|
|
120
124
|
createTime: number
|
|
121
125
|
/** 本地路径 */
|
|
122
126
|
filePath: string
|
|
127
|
+
/** 文件路径
|
|
128
|
+
* @supported alipay
|
|
129
|
+
*/
|
|
130
|
+
apFilePath: string
|
|
123
131
|
/** 本地文件大小,以字节为单位 */
|
|
124
132
|
size: number
|
|
125
133
|
}
|
|
@@ -129,6 +137,10 @@ declare module '../../index' {
|
|
|
129
137
|
interface Option {
|
|
130
138
|
/** 文件路径 */
|
|
131
139
|
filePath: string
|
|
140
|
+
/** 文件路径
|
|
141
|
+
* @supported alipay
|
|
142
|
+
*/
|
|
143
|
+
apFilePath: string
|
|
132
144
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
133
145
|
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
134
146
|
/** 接口调用失败的回调函数 */
|
|
@@ -150,6 +162,10 @@ declare module '../../index' {
|
|
|
150
162
|
interface Option {
|
|
151
163
|
/** 要读取的文件路径 */
|
|
152
164
|
filePath: string
|
|
165
|
+
/** 本地文件路径
|
|
166
|
+
* @supported alipay
|
|
167
|
+
*/
|
|
168
|
+
apFilePath: string
|
|
153
169
|
/**
|
|
154
170
|
* 计算文件摘要的算法
|
|
155
171
|
* @default 'md5'
|
|
@@ -185,12 +201,12 @@ declare module '../../index' {
|
|
|
185
201
|
*/
|
|
186
202
|
interface FileSystemManager {
|
|
187
203
|
/** 判断文件/目录是否存在
|
|
188
|
-
* @supported weapp, tt
|
|
204
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
189
205
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.access.html
|
|
190
206
|
*/
|
|
191
207
|
access(option: FileSystemManager.AccessOption): void
|
|
192
208
|
/** [FileSystemManager.access](#access) 的同步版本
|
|
193
|
-
* @supported weapp, tt
|
|
209
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
194
210
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.accessSync.html
|
|
195
211
|
*/
|
|
196
212
|
accessSync(
|
|
@@ -198,12 +214,12 @@ declare module '../../index' {
|
|
|
198
214
|
path: string,
|
|
199
215
|
): void
|
|
200
216
|
/** 在文件结尾追加内容
|
|
201
|
-
* @supported weapp
|
|
217
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
202
218
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.appendFile.html
|
|
203
219
|
*/
|
|
204
220
|
appendFile(option: FileSystemManager.AppendFileOption): void
|
|
205
221
|
/** [FileSystemManager.appendFile](#appendfile) 的同步版本
|
|
206
|
-
* @supported weapp
|
|
222
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
207
223
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.appendFileSync.html
|
|
208
224
|
*/
|
|
209
225
|
appendFileSync(
|
|
@@ -225,12 +241,12 @@ declare module '../../index' {
|
|
|
225
241
|
*/
|
|
226
242
|
closeSync(option: FileSystemManager.CloseSyncOption): void
|
|
227
243
|
/** 复制文件
|
|
228
|
-
* @supported weapp, tt
|
|
244
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
229
245
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.copyFile.html
|
|
230
246
|
*/
|
|
231
247
|
copyFile(option: FileSystemManager.CopyFileOption): void
|
|
232
248
|
/** [FileSystemManager.copyFile](#copyfile) 的同步版本
|
|
233
|
-
* @supported weapp, tt
|
|
249
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
234
250
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.copyFileSync.html
|
|
235
251
|
*/
|
|
236
252
|
copyFileSync(
|
|
@@ -260,22 +276,22 @@ declare module '../../index' {
|
|
|
260
276
|
*/
|
|
261
277
|
ftruncateSync(option: FileSystemManager.FtruncateSyncOption): void
|
|
262
278
|
/** 获取该小程序下的 `本地临时文件` 或 `本地缓存文件` 信息
|
|
263
|
-
* @supported weapp, tt
|
|
279
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
264
280
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.getFileInfo.html
|
|
265
281
|
*/
|
|
266
282
|
getFileInfo(option: FileSystemManager.getFileInfoOption): void
|
|
267
283
|
/** 获取该小程序下已保存的本地缓存文件列表
|
|
268
|
-
* @supported weapp, tt
|
|
284
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
269
285
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.getSavedFileList.html
|
|
270
286
|
*/
|
|
271
287
|
getSavedFileList(option?: FileSystemManager.getSavedFileListOption): void
|
|
272
288
|
/** 创建目录
|
|
273
|
-
* @supported weapp, tt
|
|
289
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
274
290
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.mkdir.html
|
|
275
291
|
*/
|
|
276
292
|
mkdir(option: FileSystemManager.MkdirOption): void
|
|
277
293
|
/** [FileSystemManager.mkdir](#mkdir) 的同步版本
|
|
278
|
-
* @supported weapp, tt
|
|
294
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
279
295
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.mkdirSync.html
|
|
280
296
|
*/
|
|
281
297
|
mkdirSync(
|
|
@@ -310,12 +326,12 @@ declare module '../../index' {
|
|
|
310
326
|
*/
|
|
311
327
|
readCompressedFileSync(option: FileSystemManager.readCompressedFileSync.Option): ArrayBuffer /** 文件读取结果 */
|
|
312
328
|
/** 读取目录内文件列表
|
|
313
|
-
* @supported weapp, tt
|
|
329
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
314
330
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readdir.html
|
|
315
331
|
*/
|
|
316
332
|
readdir(option: FileSystemManager.ReaddirOption): void
|
|
317
333
|
/** [FileSystemManager.readdir](#readdir) 的同步版本
|
|
318
|
-
* @supported weapp, tt
|
|
334
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
319
335
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readdirSync.html
|
|
320
336
|
*/
|
|
321
337
|
readdirSync(
|
|
@@ -323,12 +339,12 @@ declare module '../../index' {
|
|
|
323
339
|
dirPath: string,
|
|
324
340
|
): string[]
|
|
325
341
|
/** 读取本地文件内容
|
|
326
|
-
* @supported weapp, tt
|
|
342
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
327
343
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFile.html
|
|
328
344
|
*/
|
|
329
345
|
readFile(option: FileSystemManager.ReadFileOption): void
|
|
330
346
|
/** [FileSystemManager.readFile](#readfile) 的同步版本
|
|
331
|
-
* @supported weapp, tt
|
|
347
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
332
348
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFileSync.html
|
|
333
349
|
*/
|
|
334
350
|
readFileSync(
|
|
@@ -359,17 +375,17 @@ declare module '../../index' {
|
|
|
359
375
|
*/
|
|
360
376
|
readZipEntry(option: FileSystemManager.readZipEntry.Option): Promise<FileSystemManager.readZipEntry.Promised>
|
|
361
377
|
/** 删除该小程序下已保存的本地缓存文件
|
|
362
|
-
* @supported weapp
|
|
378
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
363
379
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.removeSavedFile.html
|
|
364
380
|
*/
|
|
365
381
|
removeSavedFile(option: FileSystemManager.RemoveSavedFileOption): void
|
|
366
382
|
/** 重命名文件。可以把文件从 oldPath 移动到 newPath
|
|
367
|
-
* @supported weapp, tt
|
|
383
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
368
384
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rename.html
|
|
369
385
|
*/
|
|
370
386
|
rename(option: FileSystemManager.RenameOption): void
|
|
371
387
|
/** [FileSystemManager.rename](#rename) 的同步版本
|
|
372
|
-
* @supported weapp, tt
|
|
388
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
373
389
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.renameSync.html
|
|
374
390
|
*/
|
|
375
391
|
renameSync(
|
|
@@ -394,12 +410,12 @@ declare module '../../index' {
|
|
|
394
410
|
recursive?: boolean,
|
|
395
411
|
): void
|
|
396
412
|
/** 保存临时文件到本地。此接口会移动临时文件,因此调用成功后,tempFilePath 将不可用。
|
|
397
|
-
* @supported weapp, tt
|
|
413
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
398
414
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.saveFile.html
|
|
399
415
|
*/
|
|
400
416
|
saveFile(option: FileSystemManager.SaveFileOption): void
|
|
401
417
|
/** [FileSystemManager.saveFile](#savefile) 的同步版本
|
|
402
|
-
* @supported weapp, tt
|
|
418
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
403
419
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.saveFileSync.html
|
|
404
420
|
*/
|
|
405
421
|
saveFileSync(
|
|
@@ -409,12 +425,12 @@ declare module '../../index' {
|
|
|
409
425
|
filePath?: string,
|
|
410
426
|
): string
|
|
411
427
|
/** 获取文件 Stats 对象
|
|
412
|
-
* @supported weapp, tt
|
|
428
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
413
429
|
* https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.stat.html
|
|
414
430
|
*/
|
|
415
431
|
stat(option: FileSystemManager.StatOption): void
|
|
416
432
|
/** [FileSystemManager.stat](#stat) 的同步版本
|
|
417
|
-
* @supported weapp, tt
|
|
433
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
418
434
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.statSync.html
|
|
419
435
|
*/
|
|
420
436
|
statSync(
|
|
@@ -424,22 +440,22 @@ declare module '../../index' {
|
|
|
424
440
|
recursive?: boolean,
|
|
425
441
|
): Stats | TaroGeneral.IAnyObject
|
|
426
442
|
/** 对文件内容进行截断操作
|
|
427
|
-
* @supported weapp
|
|
443
|
+
* @supported weapp, tt
|
|
428
444
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.truncate.html
|
|
429
445
|
*/
|
|
430
446
|
truncate(option: FileSystemManager.TruncateOption): void
|
|
431
447
|
/** 对文件内容进行截断操作 ([truncate](#truncate) 的同步版本)
|
|
432
|
-
* @supported weapp
|
|
448
|
+
* @supported weapp, tt
|
|
433
449
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.truncateSync.html
|
|
434
450
|
*/
|
|
435
451
|
truncateSync(option: FileSystemManager.TruncateSyncOption): void
|
|
436
452
|
/** 删除文件
|
|
437
|
-
* @supported weapp, tt
|
|
453
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
438
454
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unlink.html
|
|
439
455
|
*/
|
|
440
456
|
unlink(option: FileSystemManager.UnlinkOption): void
|
|
441
457
|
/** [FileSystemManager.unlink](#unlink) 的同步版本
|
|
442
|
-
* @supported weapp, tt
|
|
458
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
443
459
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unlinkSync.html
|
|
444
460
|
*/
|
|
445
461
|
unlinkSync(
|
|
@@ -447,7 +463,7 @@ declare module '../../index' {
|
|
|
447
463
|
filePath: string,
|
|
448
464
|
): void
|
|
449
465
|
/** 解压文件
|
|
450
|
-
* @supported weapp, tt
|
|
466
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
451
467
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unzip.html
|
|
452
468
|
*/
|
|
453
469
|
unzip(option: FileSystemManager.UnzipOption): void
|
|
@@ -457,12 +473,12 @@ declare module '../../index' {
|
|
|
457
473
|
*/
|
|
458
474
|
write(option: FileSystemManager.WriteOption): void
|
|
459
475
|
/** 写文件
|
|
460
|
-
* @supported weapp, tt
|
|
476
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
461
477
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeFile.html
|
|
462
478
|
*/
|
|
463
479
|
writeFile(option: FileSystemManager.WriteFileOption): void
|
|
464
480
|
/** [FileSystemManager.writeFile](#writefile) 的同步版本
|
|
465
|
-
* @supported weapp, tt
|
|
481
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
466
482
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeFileSync.html
|
|
467
483
|
*/
|
|
468
484
|
writeFileSync(
|
|
@@ -543,10 +559,10 @@ declare module '../../index' {
|
|
|
543
559
|
data: string | ArrayBuffer
|
|
544
560
|
/** 要追加内容的文件路径 */
|
|
545
561
|
filePath: string
|
|
546
|
-
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
547
|
-
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
548
562
|
/** 指定写入文件的字符编码 */
|
|
549
563
|
encoding?: keyof FileSystemManager.Encoding
|
|
564
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
565
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
550
566
|
/** 接口调用失败的回调函数 */
|
|
551
567
|
fail?: (result: AppendFileFailCallbackResult) => void
|
|
552
568
|
/** 接口调用成功的回调函数 */
|
|
@@ -590,6 +606,11 @@ declare module '../../index' {
|
|
|
590
606
|
interface getFileInfoOption {
|
|
591
607
|
/** 要读取的文件路径 */
|
|
592
608
|
filePath: string
|
|
609
|
+
/**
|
|
610
|
+
* 计算文件摘要的算法
|
|
611
|
+
* @default 'md5'
|
|
612
|
+
*/
|
|
613
|
+
digestAlgorithm?: 'md5' | 'sha1'
|
|
593
614
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
594
615
|
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
595
616
|
/** 接口调用失败的回调函数 */
|
|
@@ -608,6 +629,8 @@ declare module '../../index' {
|
|
|
608
629
|
interface GetFileInfoSuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
609
630
|
/** 文件大小,以字节为单位 */
|
|
610
631
|
size: number
|
|
632
|
+
/** 按照传入的 digestAlgorithm 计算得出的的文件摘要 */
|
|
633
|
+
digest?: string
|
|
611
634
|
/** 调用结果 */
|
|
612
635
|
errMsg: string
|
|
613
636
|
}
|
|
@@ -640,12 +663,15 @@ declare module '../../index' {
|
|
|
640
663
|
interface MkdirOption {
|
|
641
664
|
/** 创建的目录路径 */
|
|
642
665
|
dirPath: string
|
|
666
|
+
/** 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。
|
|
667
|
+
* 如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。
|
|
668
|
+
* @default false
|
|
669
|
+
*/
|
|
670
|
+
recursive?: boolean
|
|
643
671
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
644
672
|
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
645
673
|
/** 接口调用失败的回调函数 */
|
|
646
674
|
fail?: (result: MkdirFailCallbackResult) => void
|
|
647
|
-
/** 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。 */
|
|
648
|
-
recursive?: boolean
|
|
649
675
|
/** 接口调用成功的回调函数 */
|
|
650
676
|
success?: (res: TaroGeneral.CallbackResult) => void
|
|
651
677
|
}
|
|
@@ -789,6 +815,10 @@ declare module '../../index' {
|
|
|
789
815
|
interface RemoveSavedFileOption {
|
|
790
816
|
/** 需要删除的文件路径 */
|
|
791
817
|
filePath: string
|
|
818
|
+
/** 本地缓存文件路径
|
|
819
|
+
* @supported alipay
|
|
820
|
+
*/
|
|
821
|
+
apFilePath: string
|
|
792
822
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
793
823
|
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
794
824
|
/** 接口调用失败的回调函数 */
|
|
@@ -1286,12 +1316,12 @@ declare module '../../index' {
|
|
|
1286
1316
|
/** 文件最后一次被修改的时间,UNIX 时间戳,对应 POSIX stat.st_mtime */
|
|
1287
1317
|
lastModifiedTime: number
|
|
1288
1318
|
/** 判断当前文件是否一个目录
|
|
1289
|
-
* @supported weapp
|
|
1319
|
+
* @supported weapp, alipay, jd, qq, tt
|
|
1290
1320
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.isDirectory.html
|
|
1291
1321
|
*/
|
|
1292
1322
|
isDirectory(): boolean
|
|
1293
1323
|
/** 判断当前文件是否一个普通文件
|
|
1294
|
-
* @supported weapp
|
|
1324
|
+
* @supported weapp, aliapy, jd, qq, tt
|
|
1295
1325
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.isFile.html
|
|
1296
1326
|
*/
|
|
1297
1327
|
isFile(): boolean
|
|
@@ -1308,7 +1338,7 @@ declare module '../../index' {
|
|
|
1308
1338
|
|
|
1309
1339
|
interface TaroStatic {
|
|
1310
1340
|
/** 保存文件系统的文件到用户磁盘,仅在 PC 端支持
|
|
1311
|
-
* @supported weapp
|
|
1341
|
+
* @supported weapp, alipay
|
|
1312
1342
|
* @example
|
|
1313
1343
|
* ```tsx
|
|
1314
1344
|
* Taro.saveFileToDisk({
|
|
@@ -1326,7 +1356,7 @@ declare module '../../index' {
|
|
|
1326
1356
|
saveFileToDisk(option: saveFileToDisk.Option): Promise<TaroGeneral.CallbackResult>
|
|
1327
1357
|
|
|
1328
1358
|
/** 保存文件到本地。**注意:saveFile 会把临时文件移动,因此调用成功后传入的 tempFilePath 将不可用**
|
|
1329
|
-
* @supported weapp,
|
|
1359
|
+
* @supported weapp, alipay, swan, jd, qq, tt, rn
|
|
1330
1360
|
* @example
|
|
1331
1361
|
* ```tsx
|
|
1332
1362
|
* Taro.chooseImage({
|
|
@@ -1367,7 +1397,7 @@ declare module '../../index' {
|
|
|
1367
1397
|
removeSavedFile(option: removeSavedFile.Option): Promise<TaroGeneral.CallbackResult>
|
|
1368
1398
|
|
|
1369
1399
|
/** 新开页面打开文档,支持格式
|
|
1370
|
-
* @supported weapp, tt
|
|
1400
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
1371
1401
|
* @example
|
|
1372
1402
|
```tsx
|
|
1373
1403
|
* Taro.downloadFile({
|
|
@@ -1388,7 +1418,7 @@ declare module '../../index' {
|
|
|
1388
1418
|
openDocument(option: openDocument.Option): Promise<TaroGeneral.CallbackResult>
|
|
1389
1419
|
|
|
1390
1420
|
/** 获取本地已保存的文件列表
|
|
1391
|
-
* @supported weapp,
|
|
1421
|
+
* @supported weapp, alipay, swan, jd, qq, tt, rn
|
|
1392
1422
|
* @example
|
|
1393
1423
|
* ```tsx
|
|
1394
1424
|
* Taro.getSavedFileList({
|
|
@@ -1402,7 +1432,7 @@ declare module '../../index' {
|
|
|
1402
1432
|
getSavedFileList(option?: getSavedFileList.Option): Promise<getSavedFileList.SuccessCallbackResult>
|
|
1403
1433
|
|
|
1404
1434
|
/** 获取本地文件的文件信息。此接口只能用于获取已保存到本地的文件,若需要获取临时文件信息,请使用 [Taro.getFileInfo](/docs/apis/files/getFileInfo) 接口。
|
|
1405
|
-
* @supported weapp, rn
|
|
1435
|
+
* @supported weapp, alipay, swan, jd, qq, rn
|
|
1406
1436
|
* @example
|
|
1407
1437
|
* ```tsx
|
|
1408
1438
|
* Taro.getSavedFileInfo({
|
|
@@ -1419,7 +1449,7 @@ declare module '../../index' {
|
|
|
1419
1449
|
|
|
1420
1450
|
/**
|
|
1421
1451
|
* 获取该小程序下的 本地临时文件 或 本地缓存文件 信息
|
|
1422
|
-
* @supported weapp,
|
|
1452
|
+
* @supported weapp, alipay, swan, jd, qq, tt, rn
|
|
1423
1453
|
* @example
|
|
1424
1454
|
* ```tsx
|
|
1425
1455
|
* Taro.getFileInfo({
|
|
@@ -1434,7 +1464,7 @@ declare module '../../index' {
|
|
|
1434
1464
|
getFileInfo(option: getFileInfo.Option): Promise<getFileInfo.SuccessCallbackResult | getFileInfo.FailCallbackResult>
|
|
1435
1465
|
|
|
1436
1466
|
/** 获取全局唯一的文件管理器
|
|
1437
|
-
* @supported weapp, tt
|
|
1467
|
+
* @supported weapp, alipay, swan, jd, qq, tt
|
|
1438
1468
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getFileSystemManager.html
|
|
1439
1469
|
*/
|
|
1440
1470
|
getFileSystemManager(): FileSystemManager
|
|
@@ -7,16 +7,23 @@ declare module '../../index' {
|
|
|
7
7
|
latitude: number
|
|
8
8
|
/** 经度,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系 */
|
|
9
9
|
longitude: number
|
|
10
|
+
/** 缩放比例
|
|
11
|
+
* @weapp 范围 5~18,默认值18
|
|
12
|
+
* @alipay 范围 3~19,默认值15
|
|
13
|
+
*/
|
|
14
|
+
scale?: number
|
|
15
|
+
/** 位置名 */
|
|
16
|
+
name?: string
|
|
10
17
|
/** 地址的详细说明 */
|
|
11
18
|
address?: string
|
|
19
|
+
/** 定义在拉起的地图 App 面板中需要被屏蔽的地图类 App
|
|
20
|
+
* @supported swan
|
|
21
|
+
*/
|
|
22
|
+
ignoredApps?: Array<any>
|
|
12
23
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
13
24
|
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
14
25
|
/** 接口调用失败的回调函数 */
|
|
15
26
|
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
16
|
-
/** 位置名 */
|
|
17
|
-
name?: string
|
|
18
|
-
/** 缩放比例,范围5~18 */
|
|
19
|
-
scale?: number
|
|
20
27
|
/** 接口调用成功的回调函数 */
|
|
21
28
|
success?: (res: TaroGeneral.CallbackResult) => void
|
|
22
29
|
}
|
|
@@ -24,20 +31,32 @@ declare module '../../index' {
|
|
|
24
31
|
|
|
25
32
|
namespace getLocation {
|
|
26
33
|
interface Option {
|
|
27
|
-
/** 传入 true 会返回高度信息,由于获取高度需要较高精确度,会减慢接口返回速度
|
|
28
|
-
|
|
34
|
+
/** 传入 true 会返回高度信息,由于获取高度需要较高精确度,会减慢接口返回速度
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
altitude?: boolean
|
|
29
38
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
30
39
|
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
31
40
|
/** 接口调用失败的回调函数 */
|
|
32
41
|
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
33
42
|
/** 高精度定位超时时间(ms),指定时间内返回最高精度,该值3000ms以上高精度定位才有效果 */
|
|
34
43
|
highAccuracyExpireTime?: number
|
|
35
|
-
/** 开启高精度定位
|
|
44
|
+
/** 开启高精度定位
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
36
47
|
isHighAccuracy?: boolean
|
|
37
48
|
/** 接口调用成功的回调函数 */
|
|
38
49
|
success?: (result: SuccessCallbackResult) => void
|
|
39
|
-
/** wgs84 返回 gps 坐标,gcj02 返回可用于 Taro.openLocation 的坐标
|
|
50
|
+
/** wgs84 返回 gps 坐标,gcj02 返回可用于 Taro.openLocation 的坐标
|
|
51
|
+
* @default "wgs84"
|
|
52
|
+
*/
|
|
40
53
|
type?: string
|
|
54
|
+
/** 针对 iOS14/Android12 及以上的新特性,其他情况本参数忽略。默认情况宿主是精确定位就返回精确定位信息。
|
|
55
|
+
* 传入 true 会强制使用精确定位信息,iOS14/Android12 及以上如果没有精确定位权限,会弹出精确定位授权弹框
|
|
56
|
+
* @supported swan
|
|
57
|
+
* @default false
|
|
58
|
+
*/
|
|
59
|
+
needFullAccuracy?: boolean
|
|
41
60
|
}
|
|
42
61
|
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
43
62
|
/** 位置的精确度 */
|
|
@@ -54,6 +73,42 @@ declare module '../../index' {
|
|
|
54
73
|
speed: number
|
|
55
74
|
/** 垂直精度,单位 m(Android 无法获取,返回 0) */
|
|
56
75
|
verticalAccuracy: number
|
|
76
|
+
/** 城市名称
|
|
77
|
+
* @supported swan
|
|
78
|
+
*/
|
|
79
|
+
street?: string
|
|
80
|
+
/** 国家代码
|
|
81
|
+
* @supported swan
|
|
82
|
+
*/
|
|
83
|
+
cityCode?: string
|
|
84
|
+
/** 城市名称
|
|
85
|
+
* @supported swan, tt
|
|
86
|
+
*/
|
|
87
|
+
city?: string
|
|
88
|
+
/** 国家
|
|
89
|
+
* @supported swan
|
|
90
|
+
*/
|
|
91
|
+
country?: string
|
|
92
|
+
/** 国家代码
|
|
93
|
+
* @supported swan
|
|
94
|
+
*/
|
|
95
|
+
countryCode?: string
|
|
96
|
+
/** 省份
|
|
97
|
+
* @supported swan
|
|
98
|
+
*/
|
|
99
|
+
province?: string
|
|
100
|
+
/** 街道号码
|
|
101
|
+
* @supported swan
|
|
102
|
+
*/
|
|
103
|
+
streetNumber?: string
|
|
104
|
+
/** 区
|
|
105
|
+
* @supported swan
|
|
106
|
+
*/
|
|
107
|
+
district?: string
|
|
108
|
+
/** 是不是精确定位信息
|
|
109
|
+
* @supported swan
|
|
110
|
+
*/
|
|
111
|
+
isFullAccuracy?: boolean
|
|
57
112
|
/** 调用结果 */
|
|
58
113
|
errMsg: string
|
|
59
114
|
}
|
|
@@ -97,6 +152,12 @@ declare module '../../index' {
|
|
|
97
152
|
* @see https://lbs.qq.com/webApi/component/componentGuide/componentPicker
|
|
98
153
|
*/
|
|
99
154
|
mapOpts?: Record<string, unknown>
|
|
155
|
+
/** 页面显示标题
|
|
156
|
+
* @supported alipay
|
|
157
|
+
* @alipay 安卓默认值为 位置,iOS、IDE 默认值为 你在哪里?
|
|
158
|
+
* @see https://opendocs.alipay.com/mini/api/location?pathHash=951b46a1
|
|
159
|
+
*/
|
|
160
|
+
title?: string
|
|
100
161
|
/** 接口调用成功的回调函数 */
|
|
101
162
|
success?: (result: SuccessCallbackResult) => void
|
|
102
163
|
/** 接口调用失败的回调函数 */
|
|
@@ -114,6 +175,30 @@ declare module '../../index' {
|
|
|
114
175
|
longitude: number
|
|
115
176
|
/** 位置名称 */
|
|
116
177
|
name: string
|
|
178
|
+
/** 区县代码
|
|
179
|
+
* @supported alipay
|
|
180
|
+
*/
|
|
181
|
+
adCode?: number
|
|
182
|
+
/** 区县名称
|
|
183
|
+
* @supported alipay
|
|
184
|
+
*/
|
|
185
|
+
adName?: string
|
|
186
|
+
/** 城市代码
|
|
187
|
+
* @supported alipay
|
|
188
|
+
*/
|
|
189
|
+
cityCode?: string
|
|
190
|
+
/** 城市名称
|
|
191
|
+
* @supported alipay
|
|
192
|
+
*/
|
|
193
|
+
cityName?: string
|
|
194
|
+
/** 省份代码
|
|
195
|
+
* @supported alipay
|
|
196
|
+
*/
|
|
197
|
+
provinceCode?: number
|
|
198
|
+
/** 省份名称
|
|
199
|
+
* @supported alipay
|
|
200
|
+
*/
|
|
201
|
+
provinceName?: string
|
|
117
202
|
/** 调用结果 */
|
|
118
203
|
errMsg: string
|
|
119
204
|
}
|
|
@@ -132,6 +217,10 @@ declare module '../../index' {
|
|
|
132
217
|
|
|
133
218
|
namespace startLocationUpdateBackground {
|
|
134
219
|
interface Option {
|
|
220
|
+
/** wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标
|
|
221
|
+
* @default "gcj02"
|
|
222
|
+
*/
|
|
223
|
+
type?: string
|
|
135
224
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
136
225
|
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
137
226
|
/** 接口调用失败的回调函数 */
|
|
@@ -143,6 +232,16 @@ declare module '../../index' {
|
|
|
143
232
|
|
|
144
233
|
namespace startLocationUpdate {
|
|
145
234
|
interface Option {
|
|
235
|
+
/** wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标
|
|
236
|
+
* @default "gcj02"
|
|
237
|
+
*/
|
|
238
|
+
type?: string
|
|
239
|
+
/** 针对 iOS14/Android12 及以上的新特性,其他情况本参数忽略。默认情况宿主是精确定位就返回精确定位信息。
|
|
240
|
+
* 传入 true 会强制使用精确定位信息,iOS14/Android12 及以上如果没有精确定位权限,会弹出精确定位授权弹框
|
|
241
|
+
* @supported swan
|
|
242
|
+
* @default false
|
|
243
|
+
*/
|
|
244
|
+
needFullAccuracy?: boolean
|
|
146
245
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
147
246
|
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
148
247
|
/** 接口调用失败的回调函数 */
|
|
@@ -161,6 +260,11 @@ declare module '../../index' {
|
|
|
161
260
|
interface CallbackResult {
|
|
162
261
|
/** 错误码 */
|
|
163
262
|
errCode: number
|
|
263
|
+
/** 错误信息
|
|
264
|
+
* @supported tt
|
|
265
|
+
* @tt 最低支持版本 2.48.0
|
|
266
|
+
*/
|
|
267
|
+
errMsg?: string
|
|
164
268
|
}
|
|
165
269
|
}
|
|
166
270
|
|
|
@@ -185,13 +289,50 @@ declare module '../../index' {
|
|
|
185
289
|
speed: number
|
|
186
290
|
/** 垂直精度,单位 m(Android 无法获取,返回 0) */
|
|
187
291
|
verticalAccuracy: number
|
|
292
|
+
/** 街道名称
|
|
293
|
+
* @supported swan
|
|
294
|
+
*/
|
|
295
|
+
street?: string
|
|
296
|
+
/** 城市编码
|
|
297
|
+
* @supported swan
|
|
298
|
+
*/
|
|
299
|
+
cityCode?: string
|
|
300
|
+
/** 城市名称
|
|
301
|
+
* @supported swan, tt
|
|
302
|
+
* @tt iOS 不支持
|
|
303
|
+
*/
|
|
304
|
+
city?: string
|
|
305
|
+
/** 国家
|
|
306
|
+
* @supported swan
|
|
307
|
+
*/
|
|
308
|
+
country?: string
|
|
309
|
+
/** 国家代码
|
|
310
|
+
* @supported swan
|
|
311
|
+
*/
|
|
312
|
+
countryCode?: string
|
|
313
|
+
/** 省份
|
|
314
|
+
* @supported swan
|
|
315
|
+
*/
|
|
316
|
+
province?: string
|
|
317
|
+
/** 街道号码
|
|
318
|
+
* @supported swan
|
|
319
|
+
*/
|
|
320
|
+
streetNumber?: string
|
|
321
|
+
/** 区
|
|
322
|
+
* @supported swan
|
|
323
|
+
*/
|
|
324
|
+
district?: string
|
|
325
|
+
/** 是不是精确定位信息
|
|
326
|
+
* @supported swan
|
|
327
|
+
*/
|
|
328
|
+
isFullAccuracy?: boolean
|
|
188
329
|
}
|
|
189
330
|
}
|
|
190
331
|
|
|
191
332
|
namespace getFuzzyLocation {
|
|
192
333
|
interface Option {
|
|
193
334
|
/** wgs84 返回 gps 坐标,gcj02 返回可用于 Taro.openLocation 的坐标 */
|
|
194
|
-
type?:
|
|
335
|
+
type?: keyof Type
|
|
195
336
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
196
337
|
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
197
338
|
/** 接口调用失败的回调函数 */
|
|
@@ -200,6 +341,13 @@ declare module '../../index' {
|
|
|
200
341
|
success?: (result: SuccessCallbackResult) => void
|
|
201
342
|
}
|
|
202
343
|
|
|
344
|
+
interface Type {
|
|
345
|
+
/** 返回 gps 坐标 */
|
|
346
|
+
wgs84
|
|
347
|
+
/** 返回 gcj02 坐标*/
|
|
348
|
+
gcj02
|
|
349
|
+
}
|
|
350
|
+
|
|
203
351
|
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
204
352
|
/** 纬度,范围为 -90~90,负数表示南纬 */
|
|
205
353
|
latitude: number
|
|
@@ -210,7 +358,7 @@ declare module '../../index' {
|
|
|
210
358
|
|
|
211
359
|
interface TaroStatic {
|
|
212
360
|
/** 关闭监听实时位置变化,前后台都停止消息接收
|
|
213
|
-
* @supported weapp,
|
|
361
|
+
* @supported weapp, swan, tt, rn
|
|
214
362
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.stopLocationUpdate.html
|
|
215
363
|
*/
|
|
216
364
|
stopLocationUpdate(option?: stopLocationUpdate.Option): void
|
|
@@ -232,13 +380,13 @@ declare module '../../index' {
|
|
|
232
380
|
*
|
|
233
381
|
* **注意**
|
|
234
382
|
* - 获取位置信息需配置[地理位置用途说明](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#permission)。
|
|
235
|
-
* @supported weapp,
|
|
383
|
+
* @supported weapp, swan, tt, rn
|
|
236
384
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.startLocationUpdate.html
|
|
237
385
|
*/
|
|
238
386
|
startLocationUpdate(option?: startLocationUpdate.Option): void
|
|
239
387
|
|
|
240
388
|
/** 使用微信内置地图查看位置
|
|
241
|
-
* @supported weapp,
|
|
389
|
+
* @supported weapp, alipay, swan, jd, tt, h5
|
|
242
390
|
* @example
|
|
243
391
|
* ```tsx
|
|
244
392
|
* Taro.getLocation({
|
|
@@ -268,7 +416,7 @@ declare module '../../index' {
|
|
|
268
416
|
): void
|
|
269
417
|
|
|
270
418
|
/** 监听实时地理位置变化事件,需结合 Taro.startLocationUpdateBackground、Taro.startLocationUpdate 使用。
|
|
271
|
-
* @supported weapp,
|
|
419
|
+
* @supported weapp, swan, tt, rn
|
|
272
420
|
* @example
|
|
273
421
|
* ```tsx
|
|
274
422
|
* const _locationChangeFn = function (res) {
|
|
@@ -290,16 +438,16 @@ declare module '../../index' {
|
|
|
290
438
|
*/
|
|
291
439
|
offLocationChangeError(
|
|
292
440
|
/** 监听持续定位接口返回失败时触发的回调函数 */
|
|
293
|
-
callback
|
|
441
|
+
callback?: onLocationChangeError.Callback,
|
|
294
442
|
): void
|
|
295
443
|
|
|
296
444
|
/** 取消监听实时地理位置变化事件
|
|
297
|
-
* @supported weapp,
|
|
445
|
+
* @supported weapp, swan, tt, rn
|
|
298
446
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.offLocationChange.html
|
|
299
447
|
*/
|
|
300
448
|
offLocationChange(
|
|
301
449
|
/** 实时地理位置变化事件的回调函数 */
|
|
302
|
-
callback
|
|
450
|
+
callback?: onLocationChange.Callback,
|
|
303
451
|
): void
|
|
304
452
|
|
|
305
453
|
/** 获取当前的地理位置、速度。当用户离开小程序后,此接口无法调用。开启高精度定位,接口耗时会增加,可指定 highAccuracyExpireTime 作为超时时间。
|
|
@@ -307,7 +455,7 @@ declare module '../../index' {
|
|
|
307
455
|
* **注意**
|
|
308
456
|
* - 工具中定位模拟使用IP定位,可能会有一定误差。且工具目前仅支持 gcj02 坐标。
|
|
309
457
|
* - 使用第三方服务进行逆地址解析时,请确认第三方服务默认的坐标系,正确进行坐标转换。
|
|
310
|
-
* @supported weapp,
|
|
458
|
+
* @supported weapp, swan, jd, qq, tt, rn
|
|
311
459
|
* @example
|
|
312
460
|
* ```tsx
|
|
313
461
|
* Taro.getLocation({
|
|
@@ -333,7 +481,7 @@ declare module '../../index' {
|
|
|
333
481
|
/** 打开地图选择位置。
|
|
334
482
|
*
|
|
335
483
|
* `chooseLocation` api功能是依赖于腾讯位置服务,所以需要使用 api 密钥。如果您没有,可以前往腾讯位置服务[开发者控制台](https://lbs.qq.com/console/mykey.html?console=mykey)进行申请。
|
|
336
|
-
* @supported weapp,
|
|
484
|
+
* @supported weapp, alipay, swan, jd, tt, h5
|
|
337
485
|
* @example
|
|
338
486
|
* ```tsx
|
|
339
487
|
* // config/index.js
|
|
@@ -90,15 +90,15 @@ declare module '../../index' {
|
|
|
90
90
|
* @supported alipay
|
|
91
91
|
*/
|
|
92
92
|
height: string
|
|
93
|
-
|
|
93
|
+
/** 视频文件的宽度。
|
|
94
94
|
* @supported alipay
|
|
95
95
|
*/
|
|
96
96
|
width: string
|
|
97
|
-
|
|
97
|
+
/** 视频文件的尺寸。
|
|
98
98
|
* @supported alipay
|
|
99
99
|
*/
|
|
100
100
|
size: string
|
|
101
|
-
|
|
101
|
+
/** 录制的持续时间。
|
|
102
102
|
* @supported alipay
|
|
103
103
|
*/
|
|
104
104
|
duration: string
|
|
@@ -152,6 +152,8 @@ declare module '../../index' {
|
|
|
152
152
|
normal
|
|
153
153
|
/** 低质量 */
|
|
154
154
|
low
|
|
155
|
+
/** 原图 */
|
|
156
|
+
original
|
|
155
157
|
}
|
|
156
158
|
}
|
|
157
159
|
|
|
@@ -192,6 +194,7 @@ declare module '../../index' {
|
|
|
192
194
|
|
|
193
195
|
interface TaroStatic {
|
|
194
196
|
/** 创建 camera 上下文 CameraContext 对象。
|
|
197
|
+
* @alipay 支付宝小程序需指定 camera 组件中的 id 属性
|
|
195
198
|
* @supported weapp, rn, tt, alipay
|
|
196
199
|
* @example
|
|
197
200
|
* ```tsx
|
|
@@ -25,6 +25,25 @@ declare module '../../index' {
|
|
|
25
25
|
/** 接口调用成功的回调函数 */
|
|
26
26
|
success?: (res: TaroGeneral.CallbackResult) => void
|
|
27
27
|
}
|
|
28
|
+
|
|
29
|
+
type Callback = (
|
|
30
|
+
result: CallbackResult,
|
|
31
|
+
) => void
|
|
32
|
+
|
|
33
|
+
interface CallbackResult {
|
|
34
|
+
/** 缓存数据类别,取值为 periodic 或 pre */
|
|
35
|
+
fetchType: string
|
|
36
|
+
/** 缓存数据 */
|
|
37
|
+
fetchedData: string
|
|
38
|
+
/** 客户端拿到缓存数据的时间戳 */
|
|
39
|
+
timeStamp: number
|
|
40
|
+
/** 小程序页面路径 */
|
|
41
|
+
path: string
|
|
42
|
+
/** 传给页面的 query 参数 */
|
|
43
|
+
query: string
|
|
44
|
+
/** 进入小程序的场景值 */
|
|
45
|
+
scene: number
|
|
46
|
+
}
|
|
28
47
|
}
|
|
29
48
|
|
|
30
49
|
namespace getBackgroundFetchToken {
|
|
@@ -34,46 +53,79 @@ declare module '../../index' {
|
|
|
34
53
|
/** 接口调用失败的回调函数 */
|
|
35
54
|
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
36
55
|
/** 接口调用成功的回调函数 */
|
|
37
|
-
success?: (res:
|
|
56
|
+
success?: (res: SuccessCallbackResult) => void
|
|
57
|
+
}
|
|
58
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
59
|
+
/** 自定义的登录态 */
|
|
60
|
+
token: string
|
|
61
|
+
/** 接口调用结果 */
|
|
62
|
+
errMsg: string
|
|
38
63
|
}
|
|
39
64
|
}
|
|
40
65
|
|
|
41
66
|
namespace getBackgroundFetchData {
|
|
42
67
|
interface Option {
|
|
43
|
-
/**
|
|
68
|
+
/** 缓存数据类别
|
|
69
|
+
* @weapp 取值为 periodic
|
|
70
|
+
* @qq 取值为 periodic
|
|
71
|
+
* @alipay 取值为 pre: 数据预拉取; jsapiPre: API 预调用(目前仅支持地理位置预拉取)
|
|
72
|
+
*/
|
|
44
73
|
fetchType: string
|
|
45
74
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
46
75
|
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
47
76
|
/** 接口调用失败的回调函数 */
|
|
48
77
|
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
49
78
|
/** 接口调用成功的回调函数 */
|
|
50
|
-
success?: (res:
|
|
79
|
+
success?: (res: SuccessCallbackResult) => void
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
83
|
+
/** 缓存数据
|
|
84
|
+
* @alipay Object
|
|
85
|
+
*/
|
|
86
|
+
fetchedData: string | Object
|
|
87
|
+
/** 客户端拿到缓存数据的时间戳 ms。(iOS 时间戳存在异常,8.0.27 修复) */
|
|
88
|
+
timeStamp: number
|
|
89
|
+
/** 小程序页面路径 */
|
|
90
|
+
path: string
|
|
91
|
+
/** 传给页面的 query 参数 */
|
|
92
|
+
query: string
|
|
93
|
+
/** 进入小程序的场景值 */
|
|
94
|
+
scene: number
|
|
95
|
+
/** 缓存数据类型,与入参 fetchType 一致
|
|
96
|
+
* @supported alipay
|
|
97
|
+
*/
|
|
98
|
+
fetchType?: string
|
|
99
|
+
/** 缓存数据的时间戳。单位:ms。
|
|
100
|
+
* @supported alipay
|
|
101
|
+
*/
|
|
102
|
+
timestamp?: number
|
|
51
103
|
}
|
|
52
104
|
}
|
|
53
105
|
|
|
54
106
|
interface TaroStatic {
|
|
55
107
|
/** 设置自定义登录态,在周期性拉取数据时带上,便于第三方服务器验证请求合法性
|
|
56
|
-
* @supported weapp
|
|
108
|
+
* @supported weapp, qq
|
|
57
109
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.setBackgroundFetchToken.html
|
|
58
110
|
*/
|
|
59
|
-
setBackgroundFetchToken(option: setBackgroundFetchToken.Option):
|
|
111
|
+
setBackgroundFetchToken(option: setBackgroundFetchToken.Option): Promise<TaroGeneral.CallbackResult>
|
|
60
112
|
|
|
61
113
|
/** 收到 backgroundFetch 数据时的回调
|
|
62
|
-
* @supported weapp
|
|
114
|
+
* @supported weapp, qq
|
|
63
115
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.onBackgroundFetchData.html
|
|
64
116
|
*/
|
|
65
|
-
onBackgroundFetchData(option?: onBackgroundFetchData.Option): void
|
|
117
|
+
onBackgroundFetchData(option?: onBackgroundFetchData.Option | onBackgroundFetchData.Callback): void
|
|
66
118
|
|
|
67
119
|
/** 获取设置过的自定义登录态。若无,则返回 fail。
|
|
68
|
-
* @supported weapp
|
|
120
|
+
* @supported weapp, qq
|
|
69
121
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.getBackgroundFetchToken.html
|
|
70
122
|
*/
|
|
71
|
-
getBackgroundFetchToken(option?: getBackgroundFetchToken.Option):
|
|
123
|
+
getBackgroundFetchToken(option?: getBackgroundFetchToken.Option): Promise<TaroGeneral.CallbackResult>
|
|
72
124
|
|
|
73
125
|
/** 拉取 backgroundFetch 客户端缓存数据
|
|
74
|
-
* @supported weapp
|
|
126
|
+
* @supported weapp, alipay, qq
|
|
75
127
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.getBackgroundFetchData.html
|
|
76
128
|
*/
|
|
77
|
-
getBackgroundFetchData(option: getBackgroundFetchData.Option):
|
|
129
|
+
getBackgroundFetchData(option: getBackgroundFetchData.Option): Promise<getBackgroundFetchData.SuccessCallbackResult>
|
|
78
130
|
}
|
|
79
131
|
}
|
|
@@ -2,8 +2,42 @@ import Taro from '../../index'
|
|
|
2
2
|
|
|
3
3
|
declare module '../../index' {
|
|
4
4
|
interface CacheManager {
|
|
5
|
+
/** 当前缓存模式 */
|
|
6
|
+
mode: keyof CacheManager.Mode
|
|
7
|
+
/** 全局 origin */
|
|
8
|
+
origin: string
|
|
9
|
+
/** 全局缓存有效时间 */
|
|
10
|
+
maxAge: number
|
|
11
|
+
/** 当前缓存管理器状态 */
|
|
12
|
+
state: keyof CacheManager.State
|
|
5
13
|
/** 添加规则
|
|
6
14
|
* @supported weapp
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* const ruleId = cacheManager.addRule({
|
|
18
|
+
* id: 'haha-rule',
|
|
19
|
+
* method: 'GET',
|
|
20
|
+
* url: '/haha',
|
|
21
|
+
* maxAge: 123455,
|
|
22
|
+
* dataSchema: [
|
|
23
|
+
* // data 字段的匹配,默认为空,表示不匹配
|
|
24
|
+
* // 类型可以是:string、number、boolean、null、object、any(表示任意类型均可),以及这些类型的数组表示方式
|
|
25
|
+
* {name: 'aaa', schema: {type: 'string'}}, // 类型为 string
|
|
26
|
+
* {name: 'bbb', schema: [{type: 'number'}, {type: 'string'}]}, // 类型为 number, string
|
|
27
|
+
* {name: 'ccc', schema: {type: 'string', value: 'abc'}}, // 值为 abc
|
|
28
|
+
* {name: 'ddd', schema: {type: 'string', value: /(abc|cba)/ig}}, // 值符合该正则匹配,如果该值不是字符串类型,则会被尝试转成字符串后再进行比较
|
|
29
|
+
* {name: 'ddd', schema: {type: 'string', value: val => val === '123'}}, // 传入函数来校验值
|
|
30
|
+
* {name: 'eee', schema: {type: 'object', value: [{ // 类型为对象,则通过嵌套的方式来逐层校验
|
|
31
|
+
* name: 'aaa', schema: {type: 'string'},
|
|
32
|
+
* // ...
|
|
33
|
+
* // 嵌套 dataSchema,同上面的方式一样来匹配嵌套的对象
|
|
34
|
+
* }]}},
|
|
35
|
+
* {name: 'fff', schema: {type: 'string[]'}}, // 类型为 string 数组
|
|
36
|
+
* {name: 'ggg', schema: {type: 'any'}}, // 类型为任意类型
|
|
37
|
+
* {name: 'hhh', schema: {type: 'any[]'}}, // 类型为任意类型的数组
|
|
38
|
+
* ]
|
|
39
|
+
* })
|
|
40
|
+
* ```
|
|
7
41
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.addRule.html
|
|
8
42
|
*/
|
|
9
43
|
addRule(option: CacheManager.AddRuleOption): string
|
|
@@ -92,6 +126,22 @@ declare module '../../index' {
|
|
|
92
126
|
}
|
|
93
127
|
|
|
94
128
|
namespace CacheManager {
|
|
129
|
+
interface Mode {
|
|
130
|
+
/** 默认值,弱网/离线使用缓存返回 */
|
|
131
|
+
weakNetwork
|
|
132
|
+
/** 总是使用缓存返回 */
|
|
133
|
+
always
|
|
134
|
+
/** 不开启,后续可手动开启/停止使用缓存返回 */
|
|
135
|
+
none
|
|
136
|
+
}
|
|
137
|
+
interface State {
|
|
138
|
+
/** 不使用缓存返回 */
|
|
139
|
+
0
|
|
140
|
+
/** 使用缓存返回 */
|
|
141
|
+
1
|
|
142
|
+
/** 未知 */
|
|
143
|
+
2
|
|
144
|
+
}
|
|
95
145
|
interface DataSchema {
|
|
96
146
|
/** 需要匹配的 data 对象的参数类型
|
|
97
147
|
* string、number、boolean、null、object、any(表示任意类型),
|
|
@@ -135,6 +185,7 @@ declare module '../../index' {
|
|
|
135
185
|
rule: Rule
|
|
136
186
|
}
|
|
137
187
|
interface AddRulesOption {
|
|
188
|
+
/** 规则列表 */
|
|
138
189
|
rules: Rule[]
|
|
139
190
|
}
|
|
140
191
|
interface MatchOption {
|
|
@@ -49,6 +49,10 @@ declare module '../../index' {
|
|
|
49
49
|
keys: string[]
|
|
50
50
|
/** 限制的空间大小,单位 KB */
|
|
51
51
|
limitSize: number
|
|
52
|
+
/** 是否执行成功
|
|
53
|
+
* @supported alipay
|
|
54
|
+
*/
|
|
55
|
+
success?: boolean
|
|
52
56
|
}
|
|
53
57
|
}
|
|
54
58
|
|
|
@@ -102,9 +106,54 @@ declare module '../../index' {
|
|
|
102
106
|
}
|
|
103
107
|
}
|
|
104
108
|
|
|
109
|
+
namespace batchSetStorageSync {
|
|
110
|
+
interface Option {
|
|
111
|
+
/** [{ key, value }] */
|
|
112
|
+
kvList: kv[]
|
|
113
|
+
}
|
|
114
|
+
interface kv {
|
|
115
|
+
/** key 本地缓存中指定的 key */
|
|
116
|
+
key: string
|
|
117
|
+
/** data 需要存储的内容。只支持原生类型、Date、及能够通过JSON.stringify序列化的对象。*/
|
|
118
|
+
value: any
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
namespace batchSetStorage {
|
|
123
|
+
interface Option {
|
|
124
|
+
/** [{ key, value }] */
|
|
125
|
+
kvList: kv[]
|
|
126
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
127
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
128
|
+
/** 接口调用失败的回调函数 */
|
|
129
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
130
|
+
/** 接口调用成功的回调函数 */
|
|
131
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
132
|
+
}
|
|
133
|
+
interface kv {
|
|
134
|
+
/** key 本地缓存中指定的 key */
|
|
135
|
+
key: string
|
|
136
|
+
/** data 需要存储的内容。只支持原生类型、Date、及能够通过JSON.stringify序列化的对象。*/
|
|
137
|
+
value: any
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
namespace batchGetStorage {
|
|
142
|
+
interface Option {
|
|
143
|
+
/** 本地缓存中指定的 keyList */
|
|
144
|
+
keyList: string[]
|
|
145
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
146
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
147
|
+
/** 接口调用失败的回调函数 */
|
|
148
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
149
|
+
/** 接口调用成功的回调函数 */
|
|
150
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
105
154
|
interface TaroStatic {
|
|
106
155
|
/** Taro.setStorage 的同步版本
|
|
107
|
-
* @supported weapp,
|
|
156
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5
|
|
108
157
|
* @example
|
|
109
158
|
* ```tsx
|
|
110
159
|
* Taro.setStorage({
|
|
@@ -128,7 +177,7 @@ declare module '../../index' {
|
|
|
128
177
|
): void
|
|
129
178
|
|
|
130
179
|
/** 将数据存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。
|
|
131
|
-
* @supported weapp,
|
|
180
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn
|
|
132
181
|
* @example
|
|
133
182
|
* ```tsx
|
|
134
183
|
* Taro.setStorage({
|
|
@@ -155,7 +204,7 @@ declare module '../../index' {
|
|
|
155
204
|
): void
|
|
156
205
|
|
|
157
206
|
/** Taro.removeStorage 的同步版本
|
|
158
|
-
* @supported weapp,
|
|
207
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5
|
|
159
208
|
* @example
|
|
160
209
|
* ```tsx
|
|
161
210
|
* try {
|
|
@@ -172,7 +221,7 @@ declare module '../../index' {
|
|
|
172
221
|
): void
|
|
173
222
|
|
|
174
223
|
/** 从本地缓存中移除指定 key
|
|
175
|
-
* @supported weapp,
|
|
224
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn
|
|
176
225
|
* @example
|
|
177
226
|
* ```tsx
|
|
178
227
|
* Taro.removeStorage({
|
|
@@ -187,7 +236,7 @@ declare module '../../index' {
|
|
|
187
236
|
removeStorage(option: removeStorage.Option): Promise<TaroGeneral.CallbackResult>
|
|
188
237
|
|
|
189
238
|
/** Taro.getStorage 的同步版本
|
|
190
|
-
* @supported weapp,
|
|
239
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5
|
|
191
240
|
* @example
|
|
192
241
|
* ```tsx
|
|
193
242
|
* try {
|
|
@@ -207,7 +256,7 @@ declare module '../../index' {
|
|
|
207
256
|
): T
|
|
208
257
|
|
|
209
258
|
/** Taro.getStorageInfo 的同步版本
|
|
210
|
-
* @supported weapp,
|
|
259
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn
|
|
211
260
|
* @example
|
|
212
261
|
* ```tsx
|
|
213
262
|
* try {
|
|
@@ -224,7 +273,7 @@ declare module '../../index' {
|
|
|
224
273
|
getStorageInfoSync(): getStorageInfoSync.Option
|
|
225
274
|
|
|
226
275
|
/** 异步获取当前storage的相关信息
|
|
227
|
-
* @supported weapp,
|
|
276
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn
|
|
228
277
|
* @example
|
|
229
278
|
* ```tsx
|
|
230
279
|
* Taro.getStorageInfo({
|
|
@@ -240,7 +289,7 @@ declare module '../../index' {
|
|
|
240
289
|
getStorageInfo(option?: getStorageInfo.Option): Promise<TaroGeneral.CallbackResult>
|
|
241
290
|
|
|
242
291
|
/** 从本地缓存中异步获取指定 key 的内容
|
|
243
|
-
* @supported weapp,
|
|
292
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn
|
|
244
293
|
* @example
|
|
245
294
|
* ```tsx
|
|
246
295
|
* Taro.getStorage({
|
|
@@ -264,7 +313,7 @@ declare module '../../index' {
|
|
|
264
313
|
): void
|
|
265
314
|
|
|
266
315
|
/** Taro.clearStorage 的同步版本
|
|
267
|
-
* @supported weapp,
|
|
316
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5
|
|
268
317
|
* @example
|
|
269
318
|
* ```tsx
|
|
270
319
|
* try {
|
|
@@ -278,7 +327,7 @@ declare module '../../index' {
|
|
|
278
327
|
clearStorageSync(): void
|
|
279
328
|
|
|
280
329
|
/** 清理本地数据缓存
|
|
281
|
-
* @supported weapp,
|
|
330
|
+
* @supported weapp, alipay, swan, jd, qq, tt, h5, rn
|
|
282
331
|
* @example
|
|
283
332
|
* ```tsx
|
|
284
333
|
* Taro.clearStorage()
|
|
@@ -286,5 +335,71 @@ declare module '../../index' {
|
|
|
286
335
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.clearStorage.html
|
|
287
336
|
*/
|
|
288
337
|
clearStorage(option?: clearStorage.Option): Promise<TaroGeneral.CallbackResult>
|
|
338
|
+
|
|
339
|
+
/** 将数据批量存储在本地缓存中指定的 key 中。
|
|
340
|
+
* 会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。
|
|
341
|
+
* 单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。
|
|
342
|
+
* @supported weapp
|
|
343
|
+
* @example
|
|
344
|
+
* ```tsx
|
|
345
|
+
* try {
|
|
346
|
+
* Taro.batchSetStorageSync([{key: 'key', value: 'value'}])
|
|
347
|
+
* } catch (e) { }
|
|
348
|
+
* ```
|
|
349
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.batchGetStorageSync.html
|
|
350
|
+
*/
|
|
351
|
+
batchSetStorageSync(option: batchSetStorageSync.Option): void
|
|
352
|
+
|
|
353
|
+
/** 将数据批量存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。
|
|
354
|
+
* 除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。
|
|
355
|
+
* 单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。
|
|
356
|
+
* @supported weapp
|
|
357
|
+
* @example
|
|
358
|
+
* ```tsx
|
|
359
|
+
* Taro.batchGetStorage({
|
|
360
|
+
* keyList: ['key']
|
|
361
|
+
* success(res) {
|
|
362
|
+
* console.log(res)
|
|
363
|
+
* }
|
|
364
|
+
* })
|
|
365
|
+
* ```
|
|
366
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.batchGetStorage.html
|
|
367
|
+
*/
|
|
368
|
+
batchSetStorage(option: batchSetStorage.Option): Promise<TaroGeneral.CallbackResult>
|
|
369
|
+
|
|
370
|
+
/** 从本地缓存中同步批量获取指定 key 的内容。
|
|
371
|
+
* @supported weapp
|
|
372
|
+
* @example
|
|
373
|
+
* ```tsx
|
|
374
|
+
* try {
|
|
375
|
+
* var valueList = Taro.batchGetStorageSync(['key'])
|
|
376
|
+
* if (valueList) {
|
|
377
|
+
* // Do something with return value
|
|
378
|
+
* }
|
|
379
|
+
* } catch (e) {
|
|
380
|
+
* // Do something when catch error
|
|
381
|
+
* }
|
|
382
|
+
* ```
|
|
383
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.batchGetStorageSync.html
|
|
384
|
+
*/
|
|
385
|
+
batchGetStorageSync<T = any>(
|
|
386
|
+
/** 本地缓存中指定的 key 数组 */
|
|
387
|
+
keyList: string[]
|
|
388
|
+
): T[]
|
|
389
|
+
|
|
390
|
+
/** 从本地缓存中异步批量获取指定 key 的内容。
|
|
391
|
+
* @supported weapp
|
|
392
|
+
* @example
|
|
393
|
+
* ```tsx
|
|
394
|
+
* Taro.batchGetStorage({
|
|
395
|
+
* keyList: ['key'],
|
|
396
|
+
* success(res) {
|
|
397
|
+
* console.log(res)
|
|
398
|
+
* }
|
|
399
|
+
* })
|
|
400
|
+
* ```
|
|
401
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.batchGetStorage.html
|
|
402
|
+
*/
|
|
403
|
+
batchGetStorage(option: batchGetStorage.Option): Promise<TaroGeneral.CallbackResult>
|
|
289
404
|
}
|
|
290
405
|
}
|
package/types/api/ui/fonts.d.ts
CHANGED
|
@@ -54,13 +54,14 @@ declare module '../../index' {
|
|
|
54
54
|
/** 动态加载网络字体。文件地址需为下载类型。iOS 仅支持 https 格式文件地址。
|
|
55
55
|
*
|
|
56
56
|
* 注意:
|
|
57
|
-
* 1. 字体文件返回的
|
|
57
|
+
* 1. 字体文件返回的 context-type 参考 [font](https://www.iana.org/assignments/media-types/media-types.xhtml#font),格式不正确时会解析失败。
|
|
58
58
|
* 2. 字体链接必须是https(ios不支持http)
|
|
59
59
|
* 3. 字体链接必须是同源下的,或开启了cors支持,小程序的域名是`servicewechat.com`
|
|
60
60
|
* 4. canvas等原生组件不支持使用接口添加的字体
|
|
61
|
-
* 5. 工具里提示
|
|
62
|
-
* @supported weapp, h5
|
|
61
|
+
* 5. 工具里提示 Failed to load font 可以忽略
|
|
62
|
+
* @supported weapp, alipay, h5
|
|
63
63
|
* @h5 不支持 global (默认全局加载)
|
|
64
|
+
* @alipay source 地址格式为 `url('https://...')`,而不是单纯 URL 地址
|
|
64
65
|
* @example
|
|
65
66
|
* ```tsx
|
|
66
67
|
* Taro.loadFontFace({
|
|
@@ -44,6 +44,9 @@ export interface IH5Config {
|
|
|
44
44
|
/** 预览服务的配置,可以更改端口等参数。具体配置参考 [webpack-dev-server](https://webpack.js.org/configuration/dev-server) */
|
|
45
45
|
devServer?: webpackDevServer.Configuration
|
|
46
46
|
|
|
47
|
+
/** 用于控制是否生成 js、css 对应的 sourceMap (默认值:watch 模式下为 true,否则为 false) */
|
|
48
|
+
enableSourceMap?: boolean
|
|
49
|
+
|
|
47
50
|
/** 具体配置请参考 [Webpack devtool](https://webpack.js.org/configuration/devtool/#devtool) 配置 (默认值:'cheap-module-eval-source-map')*/
|
|
48
51
|
sourceMapType?:
|
|
49
52
|
| 'none'
|
|
@@ -3,16 +3,19 @@ import type Chain from 'webpack-chain'
|
|
|
3
3
|
import type { IOption, IPostcssOption } from './util'
|
|
4
4
|
|
|
5
5
|
interface Runtime {
|
|
6
|
-
enableInnerHTML
|
|
7
|
-
enableSizeAPIs
|
|
8
|
-
enableAdjacentHTML
|
|
9
|
-
enableTemplateContent
|
|
10
|
-
enableCloneNode
|
|
11
|
-
enableContains
|
|
12
|
-
enableMutationObserver
|
|
6
|
+
enableInnerHTML?: boolean
|
|
7
|
+
enableSizeAPIs?: boolean
|
|
8
|
+
enableAdjacentHTML?: boolean
|
|
9
|
+
enableTemplateContent?: boolean
|
|
10
|
+
enableCloneNode?: boolean
|
|
11
|
+
enableContains?: boolean
|
|
12
|
+
enableMutationObserver?: boolean
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export interface IMiniAppConfig {
|
|
16
|
+
/** 用于控制是否生成 js、css 对应的 sourceMap (默认值:watch 模式下为 true,否则为 false) */
|
|
17
|
+
enableSourceMap?: boolean
|
|
18
|
+
|
|
16
19
|
/** 默认值:'cheap-module-source-map', 具体参考[Webpack devtool 配置](https://webpack.js.org/configuration/devtool/#devtool) */
|
|
17
20
|
sourceMapType?: string
|
|
18
21
|
|
|
@@ -42,7 +45,7 @@ export interface IMiniAppConfig {
|
|
|
42
45
|
/**
|
|
43
46
|
* 编译前清空输出目录
|
|
44
47
|
* @since Taro v3.6.9
|
|
45
|
-
* @description
|
|
48
|
+
* @description
|
|
46
49
|
* - 默认清空输出目录,可设置 clean: false 不清空
|
|
47
50
|
* - 可设置 clean: { keep: ['project.config.json'] } 保留指定文件
|
|
48
51
|
* - 注意 clean.keep 不支持函数
|
package/types/taro.config.d.ts
CHANGED
|
@@ -175,6 +175,12 @@ declare module './index' {
|
|
|
175
175
|
* @default false
|
|
176
176
|
*/
|
|
177
177
|
enableShareTimeline?: boolean
|
|
178
|
+
/**
|
|
179
|
+
* 页面是否需要使用 \<page-meta\> 和 \<navigation-bar\> 组件
|
|
180
|
+
* @default false
|
|
181
|
+
* @support weapp, alipay
|
|
182
|
+
*/
|
|
183
|
+
enablePageMeta?: boolean
|
|
178
184
|
/** 页面自定义组件配置
|
|
179
185
|
* @see https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/
|
|
180
186
|
*/
|