@tarojs/taro 3.4.2 → 3.4.5

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/taro",
3
- "version": "3.4.2",
3
+ "version": "3.4.5",
4
4
  "description": "Taro framework",
5
5
  "homepage": "https://github.com/nervjs/taro/tree/master/packages/taro#readme",
6
6
  "main": "index.js",
@@ -24,9 +24,9 @@
24
24
  "author": "O2Team",
25
25
  "license": "MIT",
26
26
  "dependencies": {
27
- "@tarojs/api": "3.4.2",
28
- "@tarojs/runtime": "3.4.2",
29
- "@tarojs/taro-h5": "3.4.2"
27
+ "@tarojs/api": "3.4.5",
28
+ "@tarojs/runtime": "3.4.5",
29
+ "@tarojs/taro-h5": "3.4.5"
30
30
  },
31
- "gitHead": "26b329326c6a7da652e8d712ee33df01ab8d2d0e"
31
+ "gitHead": "789e873f7b9477124b44a900cd4f6a2810e4e06a"
32
32
  }
@@ -97,7 +97,7 @@ declare module '../../index' {
97
97
  type OnLoadCallback = (res: TaroGeneral.CallbackResult) => void
98
98
  interface OnErrorCallbackResult extends TaroGeneral.CallbackResult {
99
99
  /** 错误码
100
- * @see https://nervjs.github.io/taro/docs/apis/General#AdErrCode
100
+ * @see /docs/apis/General#aderrcode
101
101
  */
102
102
  errCode: keyof TaroGeneral.AdErrCode
103
103
  /** 错误信息 */
@@ -160,7 +160,7 @@ declare module '../../index' {
160
160
  namespace RewardedVideoAd {
161
161
  interface OnErrorCallbackResult extends TaroGeneral.CallbackResult {
162
162
  /** 错误码
163
- * @see https://nervjs.github.io/taro/docs/apis/General#AdErrCode
163
+ * @see /docs/apis/General#aderrcode
164
164
  */
165
165
  errCode: keyof TaroGeneral.AdErrCode
166
166
  /** 错误信息 */
@@ -3,9 +3,9 @@ import Taro from '../../index'
3
3
  declare module '../../index' {
4
4
  namespace canvasToTempFilePath {
5
5
  interface Option {
6
- /** 画布标识,传入 [canvas](/docs/components/canvas/canvas) 组件实例 (canvas type="2d" 时使用该属性)。 */
6
+ /** 画布标识,传入 [canvas](/docs/components/canvas) 组件实例 (canvas type="2d" 时使用该属性)。 */
7
7
  canvas?: CanvasProps
8
- /** 画布标识,传入 [canvas](/docs/components/canvas/canvas) 组件的 canvas-id */
8
+ /** 画布标识,传入 [canvas](/docs/components/canvas) 组件的 canvas-id */
9
9
  canvasId?: string
10
10
  /** 图片的质量,目前仅对 jpg 有效。取值范围为 (0, 1],不在范围内时当作 1.0 处理。 */
11
11
  quality?: number
@@ -75,7 +75,7 @@ declare module '../../index' {
75
75
  }
76
76
  namespace canvasPutImageData {
77
77
  interface Option {
78
- /** 画布标识,传入 [canvas](/docs/components/canvas/canvas) 组件的 canvas-id 属性。 */
78
+ /** 画布标识,传入 [canvas](/docs/components/canvas) 组件的 canvas-id 属性。 */
79
79
  canvasId: string
80
80
  /** 图像像素点数据,一维数组,每四项表示一个像素点的 rgba */
81
81
  data: Uint8ClampedArray
@@ -97,7 +97,7 @@ declare module '../../index' {
97
97
  }
98
98
  namespace canvasGetImageData {
99
99
  interface Option {
100
- /** 画布标识,传入 [canvas](/docs/components/canvas/canvas) 组件的 `canvas-id` 属性。 */
100
+ /** 画布标识,传入 [canvas](/docs/components/canvas) 组件的 `canvas-id` 属性。 */
101
101
  canvasId: string
102
102
  /** 将要被提取的图像数据矩形区域的高度 */
103
103
  height: number
@@ -1736,9 +1736,9 @@ declare module '../../index' {
1736
1736
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createCanvasContext.html
1737
1737
  */
1738
1738
  createCanvasContext(
1739
- /** 要获取上下文的 [canvas](/docs/components/canvas/canvas) 组件 canvas-id 属性 */
1739
+ /** 要获取上下文的 [canvas](/docs/components/canvas) 组件 canvas-id 属性 */
1740
1740
  canvasId: string,
1741
- /** 在自定义组件下,当前组件实例的this,表示在这个自定义组件下查找拥有 canvas-id 的 [canvas](/docs/components/canvas/canvas) ,如果省略则不在任何自定义组件内查找 */
1741
+ /** 在自定义组件下,当前组件实例的this,表示在这个自定义组件下查找拥有 canvas-id 的 [canvas](/docs/components/canvas) ,如果省略则不在任何自定义组件内查找 */
1742
1742
  component?: TaroGeneral.IAnyObject,
1743
1743
  ): CanvasContext
1744
1744
 
@@ -1767,7 +1767,7 @@ declare module '../../index' {
1767
1767
  */
1768
1768
  canvasToTempFilePath(
1769
1769
  option: canvasToTempFilePath.Option,
1770
- /** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](/docs/components/canvas/canvas) 组件 */
1770
+ /** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](/docs/components/canvas) 组件 */
1771
1771
  component?: TaroGeneral.IAnyObject,
1772
1772
  ): Promise<canvasToTempFilePath.SuccessCallbackResult>
1773
1773
 
@@ -1789,7 +1789,7 @@ declare module '../../index' {
1789
1789
  */
1790
1790
  canvasPutImageData(
1791
1791
  option: canvasPutImageData.Option,
1792
- /** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](/docs/components/canvas/canvas) 组件 */
1792
+ /** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](/docs/components/canvas) 组件 */
1793
1793
  component?: TaroGeneral.IAnyObject,
1794
1794
  ): Promise<TaroGeneral.CallbackResult>
1795
1795
 
@@ -1815,7 +1815,7 @@ declare module '../../index' {
1815
1815
  */
1816
1816
  canvasGetImageData(
1817
1817
  option: canvasGetImageData.Option,
1818
- /** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](/docs/components/canvas/canvas) 组件 */
1818
+ /** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](/docs/components/canvas) 组件 */
1819
1819
  component?: TaroGeneral.IAnyObject,
1820
1820
  ): Promise<canvasGetImageData.SuccessCallbackResult>
1821
1821
  }
@@ -690,6 +690,21 @@ declare module '../../index' {
690
690
  * @see https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/Cloud.database.html
691
691
  */
692
692
  database(config?: cloud.IConfig): DB.Database
693
+
694
+ /** 调用云托管服务
695
+ * @supported weapp
696
+ * @example
697
+ * 假设已经初始化了一个叫c1的云开发实例,并发起云托管调用
698
+ *
699
+ * ``` tsx
700
+ * const r = await c1.callContainer({
701
+ * path: '/path/to/container', // 填入容器的访问路径
702
+ * method: 'POST',
703
+ * })
704
+ * ```
705
+ * @see https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/container/Cloud.callContainer.html
706
+ */
707
+ callContainer < R = any, P = any >(params: cloud.CallContainerParam<P>): Promise<cloud.CallContainerResult<R>>
693
708
  }
694
709
 
695
710
  namespace DB {
@@ -139,7 +139,7 @@ declare module '../../index' {
139
139
  * @example
140
140
  * ```tsx
141
141
  * Taro.getNetworkType({
142
- * success: function (res)) {
142
+ * success: function (res) {
143
143
  * // 返回网络类型, 有效值:
144
144
  * // wifi/2g/3g/4g/unknown(Android下不常见的网络类型)/none(无网络)
145
145
  * var networkType = res.networkType
@@ -87,16 +87,22 @@ declare module '../../index' {
87
87
 
88
88
  namespace chooseLocation {
89
89
  interface Option {
90
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
91
- complete?: (res: TaroGeneral.CallbackResult) => void
92
- /** 接口调用失败的回调函数 */
93
- fail?: (res: TaroGeneral.CallbackResult) => void
94
90
  /** 目标地纬度 */
95
91
  latitude?: number
96
92
  /** 目标地经度 */
97
93
  longitude?: number
94
+ /** 地图选点组件参数
95
+ * @supported h5
96
+ * @h5 仅支持 H5 使用
97
+ * @see https://lbs.qq.com/webApi/component/componentGuide/componentPicker
98
+ */
99
+ mapOpts?: Record<string, unknown>
98
100
  /** 接口调用成功的回调函数 */
99
101
  success?: (result: SuccessCallbackResult) => void
102
+ /** 接口调用失败的回调函数 */
103
+ fail?: (res: TaroGeneral.CallbackResult) => void
104
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
105
+ complete?: (res: TaroGeneral.CallbackResult) => void
100
106
  }
101
107
 
102
108
  interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
@@ -2,7 +2,7 @@ import Taro from '../../index'
2
2
 
3
3
  declare module '../../index' {
4
4
  namespace request {
5
- interface Option < U extends string | TaroGeneral.IAnyObject | ArrayBuffer = any | any > {
5
+ interface Option <T = any, U extends string | TaroGeneral.IAnyObject | ArrayBuffer = any | any > {
6
6
  /** 开发者服务器接口地址 */
7
7
  url: string
8
8
  /** 请求的参数 */
@@ -55,7 +55,7 @@ declare module '../../index' {
55
55
  */
56
56
  enableChunked?: boolean
57
57
  /** 接口调用成功的回调函数 */
58
- success?: (result: SuccessCallbackResult) => void
58
+ success?: (result: SuccessCallbackResult<T>) => void
59
59
  /** 接口调用失败的回调函数 */
60
60
  fail?: (res: TaroGeneral.CallbackResult) => void
61
61
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
@@ -367,7 +367,7 @@ declare module '../../index' {
367
367
  * ```
368
368
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/network/request/wx.request.html
369
369
  */
370
- request<T = any, U = any>(option: request.Option<U>): RequestTask<T>
370
+ request<T = any, U = any>(option: request.Option<T, U>): RequestTask<T>
371
371
 
372
372
  /** 可以使用拦截器在请求发出前或发出后做一些额外操作。
373
373
  *
@@ -37,7 +37,7 @@ declare module '../../index' {
37
37
  }
38
38
 
39
39
  interface TaroStatic {
40
- /** **仅小程序插件中能调用该接口**,用法同 [Taro.authorize](./authorize)。目前仅支持三种 scope
40
+ /** **仅小程序插件中能调用该接口**,用法同 [Taro.authorize](../authorize)。目前仅支持三种 scope
41
41
  * @supported weapp
42
42
  * @example
43
43
  * ```tsx
@@ -5,7 +5,6 @@ declare module '../../index' {
5
5
  interface Option {
6
6
  /**
7
7
  * 是否同时获取用户订阅消息的订阅状态,默认不获取。注意:withSubscriptions 只返回用户勾选过订阅面板中的“总是保持以上选择,不再询问”的订阅消息。
8
- * 最低版本:2.10.3
9
8
  */
10
9
  withSubscriptions?: boolean
11
10
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
@@ -28,6 +27,10 @@ declare module '../../index' {
28
27
 
29
28
  namespace getSetting {
30
29
  interface Option {
30
+ /**
31
+ * 是否同时获取用户订阅消息的订阅状态,默认不获取。注意:withSubscriptions 只返回用户勾选过订阅面板中的“总是保持以上选择,不再询问”的订阅消息。
32
+ */
33
+ withSubscriptions?: boolean
31
34
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
32
35
  complete?: (res: TaroGeneral.CallbackResult) => void
33
36
  /** 接口调用失败的回调函数 */
@@ -473,7 +473,7 @@ declare module '../../index' {
473
473
  }
474
474
 
475
475
  interface TaroStatic {
476
- /** 创建一个动画实例 [animation](./Animation)。调用实例的方法来描述动画。最后通过动画实例的 export 方法导出动画数据传递给组件的 animation 属性。
476
+ /** 创建一个动画实例 [animation](../Animation)。调用实例的方法来描述动画。最后通过动画实例的 export 方法导出动画数据传递给组件的 animation 属性。
477
477
  * @supported weapp, h5
478
478
  * @example
479
479
  * ```tsx
@@ -60,7 +60,7 @@ declare module '../../index' {
60
60
  }
61
61
 
62
62
  interface TaroStatic {
63
- /** 创建一个 Worker 线程。目前限制最多只能创建一个 Worker,创建下一个 Worker 前请先调用 [Worker.terminate](/docs/apis/worker/Worker#terminate)
63
+ /** 创建一个 Worker 线程。目前限制最多只能创建一个 Worker,创建下一个 Worker 前请先调用 [Worker.terminate](/docs/apis/worker/#terminate)
64
64
  * @supported weapp
65
65
  * @example
66
66
  * ```tsx
@@ -268,7 +268,7 @@ declare module '../../index' {
268
268
  /** 回调函数 */
269
269
  callback?: NodesRef.FieldsCallback,
270
270
  ): SelectorQuery
271
- /** 获取 Node 节点实例。目前支持 [Canvas](/docs/components/canvas/canvas) 的获取。
271
+ /** 获取 Node 节点实例。目前支持 [Canvas](/docs/components/canvas) 的获取。
272
272
  * @supported weapp, h5
273
273
  * @example
274
274
  * ```tsx
@@ -9,7 +9,7 @@ declare module './index' {
9
9
  duration?: number
10
10
  }
11
11
 
12
- interface RequestParams extends request.Option<any> {
12
+ interface RequestParams<T> extends request.Option<T, any> {
13
13
  [propName: string]: any
14
14
  }
15
15
 
@@ -89,5 +89,12 @@ declare module './index' {
89
89
  * ```
90
90
  */
91
91
  setGlobalDataPlugin: SetGlobalDataPlugin
92
+
93
+ /**
94
+ * @supported weapp
95
+ * @desc 获取自定义 TabBar 对应的 React 或 Vue 组件实例
96
+ * @param page 小程序页面对象,可以通过 Taro.getCurrentInstance().page 获取
97
+ */
98
+ getTabBar<T>(page: Current['page']): T | undefined
92
99
  }
93
100
  }