@spcsn/taro 0.1.2 → 1.0.1

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 (102) hide show
  1. package/README.md +13 -6
  2. package/dist/index.js +223 -1
  3. package/dist/index.js.map +1 -1
  4. package/package.json +17 -48
  5. package/types/api/ad/index.d.ts +3 -6
  6. package/types/api/base/debug.d.ts +8 -8
  7. package/types/api/base/env.d.ts +3 -3
  8. package/types/api/base/index.d.ts +3 -3
  9. package/types/api/base/performance.d.ts +5 -5
  10. package/types/api/base/system.d.ts +8 -16
  11. package/types/api/base/update.d.ts +6 -6
  12. package/types/api/base/weapp/app-event.d.ts +12 -12
  13. package/types/api/base/weapp/life-cycle.d.ts +1 -1
  14. package/types/api/canvas/index.d.ts +71 -72
  15. package/types/api/data-analysis/index.d.ts +1 -1
  16. package/types/api/device/accelerometer.d.ts +4 -4
  17. package/types/api/device/accessibility.d.ts +1 -1
  18. package/types/api/device/battery.d.ts +2 -2
  19. package/types/api/device/bluetooth-ble.d.ts +14 -14
  20. package/types/api/device/bluetooth-peripheral.d.ts +15 -15
  21. package/types/api/device/bluetooth.d.ts +11 -11
  22. package/types/api/device/calendar.d.ts +2 -2
  23. package/types/api/device/clipboard.d.ts +2 -4
  24. package/types/api/device/compass.d.ts +4 -4
  25. package/types/api/device/gyroscope.d.ts +4 -4
  26. package/types/api/device/iBeacon.d.ts +7 -7
  27. package/types/api/device/keyboard.d.ts +3 -3
  28. package/types/api/device/memory.d.ts +2 -2
  29. package/types/api/device/motion.d.ts +4 -4
  30. package/types/api/device/network.d.ts +5 -20
  31. package/types/api/device/nfc.d.ts +17 -17
  32. package/types/api/device/phone.d.ts +1 -1
  33. package/types/api/device/scan.d.ts +1 -1
  34. package/types/api/device/screen.d.ts +6 -6
  35. package/types/api/device/sms.d.ts +1 -1
  36. package/types/api/device/vibrate.d.ts +2 -2
  37. package/types/api/device/wifi.d.ts +10 -10
  38. package/types/api/ext/index.d.ts +2 -2
  39. package/types/api/files/index.d.ts +46 -46
  40. package/types/api/framework/index.d.ts +2 -2
  41. package/types/api/location/index.d.ts +38 -45
  42. package/types/api/media/audio.d.ts +30 -30
  43. package/types/api/media/background-audio.d.ts +1 -1
  44. package/types/api/media/camera.d.ts +12 -25
  45. package/types/api/media/image.d.ts +8 -13
  46. package/types/api/media/map.d.ts +15 -15
  47. package/types/api/media/recorder.d.ts +11 -11
  48. package/types/api/media/video.d.ts +19 -21
  49. package/types/api/navigate/index.d.ts +2 -2
  50. package/types/api/network/download.d.ts +7 -8
  51. package/types/api/network/request.d.ts +14 -33
  52. package/types/api/network/upload.d.ts +7 -9
  53. package/types/api/network/websocket.d.ts +14 -14
  54. package/types/api/open-api/account.d.ts +1 -1
  55. package/types/api/open-api/address.d.ts +5 -5
  56. package/types/api/open-api/authorize.d.ts +1 -1
  57. package/types/api/open-api/login.d.ts +5 -5
  58. package/types/api/open-api/settings.d.ts +2 -2
  59. package/types/api/open-api/subscribe-message.d.ts +15 -15
  60. package/types/api/open-api/user-info.d.ts +2 -3
  61. package/types/api/payment/index.d.ts +1 -1
  62. package/types/api/route/index.d.ts +5 -8
  63. package/types/api/share/index.d.ts +3 -3
  64. package/types/api/storage/background-fetch.d.ts +6 -9
  65. package/types/api/storage/index.d.ts +11 -11
  66. package/types/api/taro.extend.d.ts +7 -24
  67. package/types/api/taro.hooks.d.ts +8 -33
  68. package/types/api/ui/animation.d.ts +33 -36
  69. package/types/api/ui/background.d.ts +2 -4
  70. package/types/api/ui/custom-component.d.ts +1 -1
  71. package/types/api/ui/fonts.d.ts +1 -10
  72. package/types/api/ui/interaction.d.ts +6 -6
  73. package/types/api/ui/menu.d.ts +1 -1
  74. package/types/api/ui/navigation-bar.d.ts +5 -7
  75. package/types/api/ui/pull-down-refresh.d.ts +2 -3
  76. package/types/api/ui/scroll.d.ts +3 -4
  77. package/types/api/ui/tab-bar.d.ts +8 -8
  78. package/types/api/ui/window.d.ts +2 -2
  79. package/types/api/wxml/index.d.ts +19 -23
  80. package/types/compile/compiler.d.ts +4 -10
  81. package/types/compile/config/index.d.ts +0 -3
  82. package/types/compile/config/mini.d.ts +17 -39
  83. package/types/compile/config/plugin.d.ts +14 -4
  84. package/types/compile/config/project.d.ts +23 -61
  85. package/types/compile/config/util.d.ts +18 -73
  86. package/types/compile/index.d.ts +16 -1
  87. package/types/compile/viteCompilerContext.d.ts +18 -52
  88. package/types/global.d.ts +1 -12
  89. package/types/index.d.ts +0 -11
  90. package/types/taro.api.d.ts +0 -9
  91. package/types/taro.component.d.ts +0 -2
  92. package/types/taro.config.d.ts +0 -120
  93. package/types/taro.runtime.d.ts +7 -3
  94. package/types/api/alipay/index.d.ts +0 -69
  95. package/types/api/qq/index.d.ts +0 -354
  96. package/types/api/swan/bookshelf.d.ts +0 -307
  97. package/types/api/swan/download-package.d.ts +0 -80
  98. package/types/api/swan/index.d.ts +0 -251
  99. package/types/api/swan/pay.d.ts +0 -139
  100. package/types/compile/config/h5.d.ts +0 -134
  101. package/types/compile/config/harmony.d.ts +0 -118
  102. package/types/compile/config/rn.d.ts +0 -85
@@ -1,354 +0,0 @@
1
- import Taro from '../../index'
2
-
3
- declare module '../../index' {
4
- namespace openQzonePublish {
5
- interface Option {
6
- /** 传递的文字内容 */
7
- text: string
8
- /** 传递的视频/图片内容,显示顺序为元素下标顺序 */
9
- media: Media[]
10
- /** 说说小尾巴跳转到的页面路径,不填则默认跳到主页 */
11
- path: string
12
- /** 说说小尾巴显示的文案,不填则默认显示小程序的简介文案 */
13
- footnote: string
14
- }
15
- type Media = {
16
- /** 图片填"photo",视频填"video" */
17
- type: MediaType
18
- /** 文件路径,必须为本地文件 */
19
- path: string
20
- }
21
- type MediaType = 'photo' | 'video'
22
- }
23
-
24
- namespace getQQRunData {
25
- interface Option {
26
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
27
- complete?: (res: TaroGeneral.CallbackResult) => void
28
- /** 接口调用失败的回调函数 */
29
- fail?: (res: TaroGeneral.CallbackResult) => void
30
- /** 接口调用成功的回调函数 */
31
- success?: (result: SuccessCallbackResult) => void
32
- }
33
- interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
34
- /**
35
- * 包括敏感数据在内的完整用户信息的加密数据,详细见加密数据解密算法。
36
- */
37
- encryptedData: string
38
- /**
39
- * 加密算法的初始向量,详细见加密数据解密算法
40
- */
41
- iv: string
42
- }
43
- }
44
-
45
- namespace setOfficialDress {
46
- interface Option {
47
- /** 方法名,设置头像填"setAvatar",其他方法后续开放 */
48
- action: string
49
- /** openid,给自己设置头像填"self" */
50
- uin: string
51
- /** 物品id */
52
- item_id?: string
53
- /** 设置头像"setAvatar"此处不用填 */
54
- busi_info?: string
55
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
56
- complete?: (res: TaroGeneral.CallbackResult) => void
57
- /** 接口调用失败的回调函数 */
58
- fail?: (res: TaroGeneral.CallbackResult) => void
59
- /** 接口调用成功的回调函数 */
60
- success?: (res: TaroGeneral.CallbackResult) => void
61
- }
62
- }
63
-
64
- namespace setCustomDress {
65
- interface Option {
66
- /** 方法名,设置头像填"uploadAvatar",其他方法后续开放 */
67
- action: string
68
- /** 素材路径,必须为本地文件,路径为 wxfile:// 的形式 */
69
- path: string
70
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
71
- complete?: (res: TaroGeneral.CallbackResult) => void
72
- /** 接口调用失败的回调函数 */
73
- fail?: (res: TaroGeneral.CallbackResult) => void
74
- /** 接口调用成功的回调函数 */
75
- success?: (res: TaroGeneral.CallbackResult) => void
76
- }
77
- }
78
-
79
- namespace updateQQApp {
80
- interface Option {
81
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
82
- complete?: (res: TaroGeneral.CallbackResult) => void
83
- /** 接口调用失败的回调函数 */
84
- fail?: (res: TaroGeneral.CallbackResult) => void
85
- /** 接口调用成功的回调函数 */
86
- success?: (res: TaroGeneral.CallbackResult) => void
87
- }
88
- }
89
-
90
- namespace addRecentColorSign {
91
- interface Option {
92
- /**
93
- * 做为点击最近彩签打开的小程序页面的启动参数,如 a=1&b=2
94
- * 默认值:当前页面的查询参数
95
- */
96
- query?: string
97
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
98
- complete?: (res: TaroGeneral.CallbackResult) => void
99
- /** 接口调用失败的回调函数 */
100
- fail?: (res: TaroGeneral.CallbackResult) => void
101
- /** 接口调用成功的回调函数 */
102
- success?: (res: TaroGeneral.CallbackResult) => void
103
- }
104
- }
105
-
106
- namespace getGuildInfo {
107
- interface Option {
108
- /** 频道id */
109
- open_guild_id: string
110
- /** 子频道Id */
111
- channel_id?: string
112
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
113
- complete?: (res: TaroGeneral.CallbackResult) => void
114
- /** 接口调用失败的回调函数 */
115
- fail?: (res: TaroGeneral.CallbackResult) => void
116
- /** 接口调用成功的回调函数 */
117
- success?: (res: SuccessCallbackResult) => void
118
- }
119
- interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
120
- /** 加密之后的数据,需要解密 */
121
- encryptedData: string
122
- /** 对称解密算法初始向量(base64) */
123
- iv: string
124
- /** 签名(base64) */
125
- signature: string
126
- }
127
- }
128
-
129
- namespace applyAddToMyApps {
130
- interface Option {
131
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
132
- complete?: (res: TaroGeneral.CallbackResult) => void
133
- /** 接口调用失败的回调函数 */
134
- fail?: (res: TaroGeneral.CallbackResult) => void
135
- /** 接口调用成功的回调函数 */
136
- success?: (res: SuccessCallbackResult) => void
137
- }
138
- interface SuccessCallbackResult {
139
- /** true 代表用户选择了同意 */
140
- confirm: boolean
141
- /** true 代表用户选择了不同意 */
142
- cancel: boolean
143
- }
144
- }
145
-
146
- namespace isAddedToMyApps {
147
- interface Option {
148
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
149
- complete?: (res: TaroGeneral.CallbackResult) => void
150
- /** 接口调用失败的回调函数 */
151
- fail?: (res: TaroGeneral.CallbackResult) => void
152
- /** 接口调用成功的回调函数 */
153
- success?: (res: SuccessCallbackResult) => void
154
- }
155
- interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
156
- /** true 代表用户已经添加,false 则还没添加 */
157
- isAdded: boolean
158
- }
159
- }
160
-
161
- interface TaroStatic {
162
- /**
163
- * 此接口可打开手Q说说发表界面,并将文字内容和图片/视频内容传递到手Q说说发表界面。
164
- * @supported qq
165
- * @example
166
- * ```tsx
167
- * Taro.openQzonePublish({
168
- * footnote: '使用同款滤镜',
169
- * path: 'pages/index/index',
170
- * text: '我爱中国',
171
- * media: [
172
- * {
173
- * type: 'photo',
174
- * path: 'qqfile://1.png'
175
- * },
176
- * {
177
- * type: 'video',
178
- * path: 'qqfile://2.mp4'
179
- * }
180
- * ]
181
- * })
182
- * ```
183
- * @see https://q.qq.com/wiki/develop/miniprogram/API/open_port/port_openQzonePublish.html
184
- */
185
- openQzonePublish(option: openQzonePublish.Option): void
186
- /**
187
- * 获取用户过去三十天QQ运动步数。需要先调用 qq.login 接口。步数信息会在用户主动进入小程序时更新。
188
- * @supported qq
189
- * @example
190
- * ```tsx
191
- * Taro.getQQRunData({
192
- * success(res) {
193
- * // 拿 encryptedData 到开发者后台解密开放数据
194
- * const encryptedData = res.encryptedData
195
- * }
196
- * })
197
- * ```
198
- *
199
- * **开放数据 JSON 结构**
200
- * 敏感数据有两种获取方式,一是使用 加密数据解密算法 。 获取得到的开放数据为以下 json 结构:
201
- *
202
- * ```json
203
- * {
204
- * "stepInfoList": [
205
- * {
206
- * "timestamp": 1445866601,
207
- * "step": 100
208
- * },
209
- * {
210
- * "timestamp": 1445876601,
211
- * "step": 120
212
- * }
213
- * ]
214
- * }
215
- * ```
216
- * * stepInfoList 中,每一项结构如下:
217
- *
218
- * | 属性 | 类型 | 说明 |
219
- * | --- | ---- | --- |
220
- * | timestamp | number | 时间戳,表示数据对应的时间 |
221
- * | step | number | QQ运动步数 |
222
- *
223
- * @see https://q.qq.com/wiki/develop/miniprogram/API/open_port/port_sport.html
224
- */
225
- getQQRunData(option: getQQRunData.Option): void
226
- /**
227
- * QQ美化平台内测阶段,仅被邀请的商户可使用此接口。
228
- * @supported qq
229
- * @example
230
- * ```tsx
231
- * Taro.setOfficialDress({
232
- * action: "setAvatar",
233
- * uin: "self",
234
- * item_id: "2740",
235
- * success(res) {
236
- * console.log("success"+res);
237
- * },
238
- * fail(res) {
239
- * console.log("fail"+res);
240
- * }
241
- * })
242
- * ```
243
- * @see https://q.qq.com/wiki/develop/miniprogram/API/open_port/personalize.html#qq-setofficialdress
244
- */
245
- setOfficialDress(option: setOfficialDress.Option): void
246
- /**
247
- * QQ美化平台内测阶段,仅被邀请的商户可使用此接口。
248
- * @supported qq
249
- * @example
250
- * ```tsx
251
- * Taro.setCustomDress({
252
- * action: "uploadAvatar",
253
- * path:"wxfile://images/1.png"
254
- * success(res) {
255
- * console.log("success"+res);
256
- * },
257
- * fail(res) {
258
- * console.log("fail"+res);
259
- * }
260
- * })
261
- * ```
262
- * @see https://q.qq.com/wiki/develop/miniprogram/API/open_port/personalize.html#qq-setcustomdress
263
- */
264
- setCustomDress(option: setCustomDress.Option): void
265
- /**
266
- * 更新 QQ 版本
267
- * @supported qq
268
- * @example
269
- * ```tsx
270
- * Taro.updateQQApp({
271
- * success: function(res) {
272
- * console.log('updateQQApp success',res)
273
- * },
274
- * fail: function(err) {
275
- * console.log('updateQQApp fail',err)
276
- * },
277
- * complete: function(res) {
278
- * console.log('updateQQApp info',res)
279
- * }
280
- * })
281
- * ```
282
- * @see https://q.qq.com/wiki/develop/miniprogram/API/open_port/port_updateQQ.html#qq-updateqqapp
283
- */
284
- updateQQApp(option: updateQQApp.Option): void
285
- /**
286
- * 添加当前小程序页面到最近浏览彩签,需要授权基础库 1.20.0 开始支持。
287
- * 提示:在手 Q 8.9.0 前的版本,当系统未授予手 Q 悬浮穿权限时,每次调用该接口都会弹出系统授权窗口。自手 Q 8.9.0 起交互调整如下:
288
- * 1. 系统没有授予手 Q 悬浮窗权限时,接口执行 fail 回调函数并附带 ”No floating window permission“的错误信息,开发者可针对此信息在业务代码里弹窗提示用户手动授予手 Q 悬浮窗权限。
289
- * 2. 安卓系统部分机型存在获取悬浮窗权限不准确情况。
290
- * @supported qq
291
- * @example
292
- * ```tsx
293
- * Taro.addRecentColorSign({
294
- * query: 'a=1&b=2',
295
- * success(res) {
296
- * console.log('addRecentColorSign success: ', res)
297
- * },
298
- * fail(err) {
299
- * console.log('addRecentColorSign fail: ', err)
300
- * },
301
- * complete(res) {
302
- * console.log('addRecentColorSign complete: ', res)
303
- * }
304
- * })
305
- * ```
306
- * @see https://q.qq.com/wiki/develop/miniprogram/API/open_port/port_addColorSign.html#qq-addrecentcolorsign
307
- */
308
- addRecentColorSign(option: addRecentColorSign.Option): void
309
- /**
310
- * 获取频道信息与当前人身份(FOR 机器人服务入口)
311
- * @supported qq
312
- * @see https://q.qq.com/wiki/develop/miniprogram/API/open_port/port_guild.html
313
- */
314
- getGuildInfo(option: getGuildInfo.Option): void
315
- /**
316
- * 申请用户将本小程序添加到下拉页面中“我的小程序”当中,手Q8.9.13及以上版本支持
317
- * @supported qq
318
- * @example
319
- * ```tsx
320
- * Taro.applyAddToMyApps({
321
- * success(res) {
322
- * if (res.confirm) {
323
- * // 用户同意添加
324
- * }
325
- * if (res.cancel) {
326
- * // 用户不同意添加
327
- * }
328
- * // 原则上,confirm和cancel是互斥的
329
- * }
330
- * })
331
- * ```
332
- * @see https://q.qq.com/wiki/develop/miniprogram/API/open_port/port_addToMyApps.html#qq-applyaddtomyapps
333
- */
334
- applyAddToMyApps(option: applyAddToMyApps.Option): void
335
- /**
336
- * 查询用户是否已经将本小程序添加到下拉页面中“我的小程序”当中,手Q8.9.13及以上版本支持,建议使用qq.applyAddToMyApps之前先调用qq.isAddedToMyApps来作前置判断
337
- * @supported qq
338
- * @example
339
- * ```tsx
340
- * Taro.isAddedToMyApps({
341
- * success(res) {
342
- * if (res.isAdded) {
343
- * // 用户已经添加
344
- * } else {
345
- * // 用户还未添加
346
- * }
347
- * }
348
- * })
349
- * ```
350
- * @see https://q.qq.com/wiki/develop/miniprogram/API/open_port/port_addToMyApps.html#qq-isaddedtomyapps
351
- */
352
- isAddedToMyApps(option: isAddedToMyApps.Option): void
353
- }
354
- }
@@ -1,307 +0,0 @@
1
- import Taro from '../../index'
2
-
3
- declare module '../../index' {
4
- namespace insertBookshelf {
5
- interface Option {
6
- /** 添加的内容分类 */
7
- category: keyof Category | string
8
- /** 要添加到书架内容的 id,支持传多个,最多 100 条;注释:contentId 为内容 id,内容的唯一标识,自定义,最长 22 字符(不能含有空格、中文字符) */
9
- contentIds: string[]
10
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
11
- complete?: (res: TaroGeneral.CallbackResult) => void
12
- /** 接口调用失败的回调函数 */
13
- fail?: (res: TaroGeneral.CallbackResult) => void
14
- /** 接口调用成功的回调函数 */
15
- success?: (res: SuccessCallbackResult) => void
16
- }
17
- interface Category {
18
- /** 专栏模板 */
19
- article
20
- /** 文档模板 */
21
- doc
22
- /** 动漫模板 */
23
- cartoon
24
- /** 影音模板 */
25
- av
26
- }
27
- interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
28
- /** 添加到书架的结果列表 */
29
- list: IListItem[]
30
- }
31
- interface IListItem {
32
- /** 内容的唯一标识 */
33
- contentId: string
34
- /** 添加状态:值为 0 时是失败,为 1 时是成功 */
35
- status: keyof Status
36
- /** 添加信息 */
37
- msg: string
38
- }
39
- interface Status {
40
- /** 失败 */
41
- 0
42
- /** 成功 */
43
- 1
44
- }
45
- }
46
-
47
- namespace deleteBookshelf {
48
- interface Option {
49
- /** 要删除的内容分类 */
50
- category: keyof Category | string
51
- /** 要删除书架内容的 id,支持传多个,最多 100 条;注释:contentId 为内容 id,内容的唯一标识,自定义,最长 22 字符(不能含有空格、中文字符)。支持批量删除的同一个 category 下的多个 id,不同 category 下的 id 请分别调用该接口删除 */
52
- contentIds: string[]
53
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
54
- complete?: (res: TaroGeneral.CallbackResult) => void
55
- /** 接口调用失败的回调函数 */
56
- fail?: (res: TaroGeneral.CallbackResult) => void
57
- /** 接口调用成功的回调函数 */
58
- success?: (res: SuccessCallbackResult) => void
59
- }
60
- interface Category {
61
- /** 专栏模板 */
62
- article
63
- /** 文档模板 */
64
- doc
65
- /** 动漫模板 */
66
- cartoon
67
- /** 影音模板 */
68
- av
69
- }
70
- interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
71
- /** 添加到书架的结果列表 */
72
- list: IListItem[]
73
- }
74
- interface IListItem {
75
- /** 内容的唯一标识 */
76
- contentId: string
77
- /** 删除状态:值为 0 时是失败,为 1 时是成功 */
78
- status: keyof Status
79
- /** 删除信息 */
80
- msg: string
81
- }
82
- interface Status {
83
- /** 失败 */
84
- 0
85
- /** 成功 */
86
- 1
87
- }
88
- }
89
-
90
- namespace queryBookshelf {
91
- interface Option {
92
- /** 要查询内容的 id,支持传多个,最多 100 条;注释:contentId 为内容 id,内容的唯一标识,自定义,最长 22 字符(不能含有空格、中文字符) */
93
- contentIds: string[]
94
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
95
- complete?: (res: TaroGeneral.CallbackResult) => void
96
- /** 接口调用失败的回调函数 */
97
- fail?: (res: TaroGeneral.CallbackResult) => void
98
- /** 接口调用成功的回调函数 */
99
- success?: (res: TaroGeneral.CallbackResult) => void
100
- }
101
- interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
102
- /** 查询的内容结果列表 */
103
- list: IListItem[]
104
- }
105
- interface IListItem {
106
- /** 内容的唯一标识 */
107
- contentId: string
108
- /** 状态 */
109
- status: keyof Status
110
- }
111
- interface Status {
112
- /** 不存在 */
113
- 0
114
- /** 存在 */
115
- 1
116
- }
117
- }
118
-
119
- namespace updateBookshelfReadTime {
120
- interface Option {
121
- /** 添加的内容分类 */
122
- category: keyof Category | string
123
- /** 要更新内容的 id;注释:contentId 为内容 id,内容的唯一标识,自定义,最长 22 字符(不能含有空格、中文字符) */
124
- contentIds: string[]
125
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
126
- complete?: (res: TaroGeneral.CallbackResult) => void
127
- /** 接口调用失败的回调函数 */
128
- fail?: (res: TaroGeneral.CallbackResult) => void
129
- /** 接口调用成功的回调函数 */
130
- success?: (res: SuccessCallbackResult) => void
131
- }
132
- interface Category {
133
- /** 专栏模板 */
134
- article
135
- /** 文档模板 */
136
- doc
137
- /** 动漫模板 */
138
- cartoon
139
- /** 影音模板 */
140
- av
141
- }
142
- interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
143
- /** 更新状态 */
144
- status: keyof Status
145
- /** 更新的结果信息 */
146
- msg: string
147
- }
148
- interface Status {
149
- /** 失败 */
150
- 0
151
- /** 成功 */
152
- 1
153
- }
154
- }
155
-
156
- namespace navigateToBookshelf {
157
- interface Option {
158
- /** 跳转到指定的内容分类
159
- * @supported swan
160
- */
161
- category: keyof Category | string
162
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
163
- complete?: (res: TaroGeneral.CallbackResult) => void
164
- /** 接口调用失败的回调函数 */
165
- fail?: (res: TaroGeneral.CallbackResult) => void
166
- /** 接口调用成功的回调函数 */
167
- success?: (res: TaroGeneral.CallbackResult) => void
168
- }
169
- interface Category {
170
- /** 专栏模板 */
171
- article
172
- /** 文档模板 */
173
- doc
174
- /** 动漫模板 */
175
- cartoon
176
- /** 影音模板 */
177
- av
178
- }
179
- }
180
-
181
- interface TaroStatic {
182
- /** 添加内容到宿主书架
183
- * @supported swan, qq
184
- * @swan (需宿主支持书架入口)
185
- * @example
186
- * ```tsx
187
- * Taro.insertBookshelf({
188
- * category: 'doc',
189
- * contentIds: ['test1', 'test2'],
190
- * success(res) {
191
- * Taro.showModal({
192
- * title: 'success',
193
- * content: JSON.stringify(res)
194
- * })
195
- * },
196
- * fail(err) {
197
- * Taro.showModal({
198
- * title: 'fail',
199
- * content: JSON.stringify(err)
200
- * })
201
- * }
202
- * })
203
- * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-insertBookshelf/
204
- */
205
- insertBookshelf(option: insertBookshelf.Option): void
206
-
207
- /** 删除书架中的内容(需宿主支持书架入口)
208
- * @supported swan
209
- * @example
210
- * ```tsx
211
- * Taro.deleteBookshelf({
212
- * category: 'doc',
213
- * contentIds: ['test1', 'test2'],
214
- * success(res) {
215
- * Taro.showModal({
216
- * title: 'success',
217
- * content: JSON.stringify(res)
218
- * })
219
- * },
220
- * fail(err) {
221
- * Taro.showModal({
222
- * title: 'fail',
223
- * content: JSON.stringify(err)
224
- * })
225
- * }
226
- * })
227
- * ```
228
- * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-deleteBookshelf/
229
- */
230
- deleteBookshelf(option: deleteBookshelf.Option): void
231
-
232
- /** 查询宿主书架的相关内容
233
- * @supported swan, qq
234
- * @swan (需宿主支持书架入口)
235
- * @example
236
- * ```tsx
237
- * Taro.queryBookshelf({
238
- * contentIds: ['test1', 'test2'],
239
- * success(res) {
240
- * Taro.showModal({
241
- * title: 'success',
242
- * content: JSON.stringify(res)
243
- * })
244
- * },
245
- * fail(err) {
246
- * Taro.showModal({
247
- * title: 'fail',
248
- * content: JSON.stringify(err)
249
- * })
250
- * }
251
- * })
252
- * ```
253
- * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-queryBookshelf/
254
- */
255
- queryBookshelf(option: queryBookshelf.Option): void
256
-
257
- /** 更新已加入宿主书架的内容的阅读时间
258
- * @supported swan, qq
259
- * @swan (需宿主支持书架入口)
260
- * @example
261
- * ```tsx
262
- * Taro.updateBookshelfReadTime({
263
- * category: 'doc',
264
- * contentIds: 'test1',
265
- * success(res) {
266
- * Taro.showModal({
267
- * title: 'success',
268
- * content: JSON.stringify(res)
269
- * })
270
- * },
271
- * fail(err) {
272
- * Taro.showModal({
273
- * title: 'fail',
274
- * content: JSON.stringify(err)
275
- * })
276
- * }
277
- * })
278
- * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-queryBookshelf/
279
- */
280
- updateBookshelfReadTime(option: updateBookshelfReadTime.Option): void
281
-
282
- /** 跳转到宿主书架
283
- * @supported swan
284
- * @swan (需宿主支持书架入口)
285
- * @example
286
- * ```tsx
287
- * Taro.navigateToBookshelf({
288
- * category: 'article',
289
- * contentIds: 'test1',
290
- * success(res) {
291
- * Taro.showModal({
292
- * title: 'navigateToBookshelf',
293
- * content: 'success'
294
- * })
295
- * },
296
- * fail(err) {
297
- * Taro.showModal({
298
- * title: 'fail',
299
- * content: JSON.stringify(err)
300
- * })
301
- * }
302
- * })
303
- * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-navigateToBookshelf/
304
- */
305
- navigateToBookshelf(option: navigateToBookshelf.Option): void
306
- }
307
- }