Skip to content

Commit 1a68a37

Browse files
committed
refactor(types): sync components types
1 parent 0d98f5a commit 1a68a37

21 files changed

+467
-172
lines changed

docs/apis/canvas/CanvasContext.md

Lines changed: 96 additions & 92 deletions
Large diffs are not rendered by default.

docs/apis/open-api/device-voip/requestDeviceVoIP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ sidebar_label: requestDeviceVoIP
3333
| groupId | `string` || 设备组的唯一标识 id 。isGroup 为 true 时只需要传该参数,isGroup 为 false 时不需要传该参数,但需要传 sn、snTicket、modelId、deviceName 。 |
3434
| complete | `(res: TaroGeneral.CallbackResult) => void` || 接口调用结束的回调函数(调用成功、失败都会执行) |
3535
| fail | `(res: TaroGeneral.CallbackResult) => void` || 接口调用失败的回调函数 |
36-
| success | `(result: SuccessCallbackResult) => void` || 接口调用成功的回调函数 |
36+
| success | `(result: TaroGeneral.CallbackResult) => void` || 接口调用成功的回调函数 |

docs/apis/open-api/my-miniprogram/checkIsAddedToMyMiniProgram.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ sidebar_label: checkIsAddedToMyMiniProgram
1212
## 类型
1313

1414
```tsx
15-
(option?: Option) => Promise<SuccessCallbackResult>
15+
(option?: Option) => void
1616
```
1717

1818
## 参数
@@ -27,7 +27,7 @@ sidebar_label: checkIsAddedToMyMiniProgram
2727
| --- | --- | :---: | --- |
2828
| complete | `(res: TaroGeneral.CallbackResult) => void` || 接口调用结束的回调函数(调用成功、失败都会执行) |
2929
| fail | `(res: TaroGeneral.CallbackResult) => void` || 接口调用失败的回调函数 |
30-
| success | `(res: TaroGeneral.CallbackResult) => void` || 接口调用成功的回调函数 |
30+
| success | `(res: SuccessCallbackResult) => void` || 接口调用成功的回调函数 |
3131

3232
### SuccessCallbackResult
3333

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: Taro.getPrivacySetting(option)
3+
sidebar_label: getPrivacySetting
4+
---
5+
6+
查询隐私授权情况。隐私合规开发指南详情可见《小程序隐私协议开发指南》
7+
8+
支持情况:<img title="微信小程序" src={require('@site/static/img/platform/weapp.png').default} className="icon_platform" width="25px"/> <img title="H5" src={require('@site/static/img/platform/h5.png').default} className="icon_platform icon_platform--not-support" width="25px"/> <img title="React Native" src={require('@site/static/img/platform/rn.png').default} className="icon_platform icon_platform--not-support" width="25px"/> <img title="Harmony" src={require('@site/static/img/platform/harmony.png').default} className="icon_platform icon_platform--not-support" width="25px"/>
9+
10+
> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/privacy/wx.getPrivacySetting.html)
11+
12+
## 类型
13+
14+
```tsx
15+
(option?: Option) => void
16+
```
17+
18+
## 参数
19+
20+
| 参数 | 类型 |
21+
| --- | --- |
22+
| option | `Option` |
23+
24+
### Option
25+
26+
| 参数 | 类型 | 必填 | 说明 |
27+
| --- | --- | :---: | --- |
28+
| complete | `(res: TaroGeneral.CallbackResult) => void` || 接口调用结束的回调函数(调用成功、失败都会执行) |
29+
| fail | `(res: TaroGeneral.CallbackResult) => void` || 接口调用失败的回调函数 |
30+
| success | `(result: SuccessCallbackResult) => void` || 接口调用成功的回调函数 |
31+
32+
### SuccessCallbackResult
33+
34+
| 参数 | 类型 | 说明 |
35+
| --- | --- | --- |
36+
| needAuthorization | `boolean` | 是否需要用户授权隐私协议(如果开发者没有在[mp后台-设置-服务内容声明-用户隐私保护指引]中声明隐私收集类型则会返回false;如果开发者声明了隐私收集,且用户之前同意过隐私协议则会返回false;如果开发者声明了隐私收集,且用户还没同意过则返回true;如果用户之前同意过、但后来小程序又新增了隐私收集类型也会返回true) |
37+
| privacyContractName | `string` | 隐私授权协议的名称 |
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
title: Taro.onNeedPrivacyAuthorization(listener)
3+
sidebar_label: onNeedPrivacyAuthorization
4+
---
5+
6+
监听隐私接口需要用户授权事件。当需要用户进行隐私授权时会触发。触发该事件时,开发者需要弹出隐私协议说明,并在用户同意或拒绝授权后调用回调接口 resolve 触发原隐私接口或组件继续执行。隐私合规开发指南详情可见《小程序隐私协议开发指南》
7+
8+
支持情况:<img title="微信小程序" src={require('@site/static/img/platform/weapp.png').default} className="icon_platform" width="25px"/> <img title="H5" src={require('@site/static/img/platform/h5.png').default} className="icon_platform icon_platform--not-support" width="25px"/> <img title="React Native" src={require('@site/static/img/platform/rn.png').default} className="icon_platform icon_platform--not-support" width="25px"/> <img title="Harmony" src={require('@site/static/img/platform/harmony.png').default} className="icon_platform icon_platform--not-support" width="25px"/>
9+
10+
> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/privacy/wx.onNeedPrivacyAuthorization.html)
11+
12+
## 类型
13+
14+
```tsx
15+
(listener: Listener) => void
16+
```
17+
18+
## 参数
19+
20+
| 参数 | 类型 |
21+
| --- | --- |
22+
| listener | `Listener` |
23+
24+
### ResolveOption
25+
26+
resolve 是 onNeedPrivacyAuthorization 的回调参数,是一个接口函数。
27+
当触发 needPrivacyAuthorization 事件时,触发该事件的隐私接口或组件会处于 pending 状态。
28+
如果调用 resolve({ buttonId: 'disagree-btn', event:'agree' }),则触发当前 needPrivacyAuthorization 事件的原隐私接口或组件会继续执行。其中 buttonId 为隐私同意授权按钮的id,为确保用户有同意的操作,基础库会检查对应的同意按钮是否被点击过。
29+
如果调用 resolve({ event: 'disagree' }),则触发当前 needPrivacyAuthorization 事件的原隐私接口或组件会失败并返回 API:fail privacy permission is not authorized 的错误信息。
30+
在调用 resolve({ event: 'agree'/'disagree' }) 之前,开发者可以调用 resolve({ event: 'exposureAuthorization' }) 把隐私弹窗曝光告知平台。
31+
32+
| 参数 | 类型 | 必填 | 说明 |
33+
| --- | --- | :---: | --- |
34+
| event | "exposureAuthorization" or "agree" or "disagree" || 用户操作类型 |
35+
| buttonId | `string` || 同意授权按钮的id (仅event=agree时必填) |
36+
37+
### EventInfo
38+
39+
触发本次 onNeedPrivacyAuthorization 事件的关联信息
40+
41+
| 参数 | 类型 |
42+
| --- | --- |
43+
| referrer | `string` |
44+
45+
### Listener
46+
47+
隐私授权监听函数
48+
49+
```tsx
50+
(resolve: (option: ResolveOption) => void,eventInfo: EventInfo) => void
51+
```
52+
53+
| 参数 | 类型 | 说明 |
54+
| --- | --- | --- |
55+
| resolve | `(option: ResolveOption) => void` | 事件回调函数 |
56+
| eventInfo | `EventInfo` | 关联事件信息 |
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: Taro.openPrivacyContract(option)
3+
sidebar_label: openPrivacyContract
4+
---
5+
6+
跳转至隐私协议页面。隐私合规开发指南详情可见《小程序隐私协议开发指南》
7+
8+
支持情况:<img title="微信小程序" src={require('@site/static/img/platform/weapp.png').default} className="icon_platform" width="25px"/> <img title="H5" src={require('@site/static/img/platform/h5.png').default} className="icon_platform icon_platform--not-support" width="25px"/> <img title="React Native" src={require('@site/static/img/platform/rn.png').default} className="icon_platform icon_platform--not-support" width="25px"/> <img title="Harmony" src={require('@site/static/img/platform/harmony.png').default} className="icon_platform icon_platform--not-support" width="25px"/>
9+
10+
> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/privacy/wx.openPrivacyContract.html)
11+
12+
## 类型
13+
14+
```tsx
15+
(option?: Option) => void
16+
```
17+
18+
## 参数
19+
20+
| 参数 | 类型 |
21+
| --- | --- |
22+
| option | `Option` |
23+
24+
### Option
25+
26+
| 参数 | 类型 | 必填 | 说明 |
27+
| --- | --- | :---: | --- |
28+
| complete | `(res: TaroGeneral.CallbackResult) => void` || 接口调用结束的回调函数(调用成功、失败都会执行) |
29+
| fail | `(res: TaroGeneral.CallbackResult) => void` || 接口调用失败的回调函数 |
30+
| success | `(result: TaroGeneral.CallbackResult) => void` || 接口调用成功的回调函数 |
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: Taro.requirePrivacyAuthorize(option)
3+
sidebar_label: requirePrivacyAuthorize
4+
---
5+
6+
模拟隐私接口调用,并触发隐私弹窗逻辑。隐私合规开发指南详情可见《小程序隐私协议开发指南》
7+
8+
支持情况:<img title="微信小程序" src={require('@site/static/img/platform/weapp.png').default} className="icon_platform" width="25px"/> <img title="H5" src={require('@site/static/img/platform/h5.png').default} className="icon_platform icon_platform--not-support" width="25px"/> <img title="React Native" src={require('@site/static/img/platform/rn.png').default} className="icon_platform icon_platform--not-support" width="25px"/> <img title="Harmony" src={require('@site/static/img/platform/harmony.png').default} className="icon_platform icon_platform--not-support" width="25px"/>
9+
10+
> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/privacy/wx.requirePrivacyAuthorize.html)
11+
12+
## 类型
13+
14+
```tsx
15+
(option?: Option) => void
16+
```
17+
18+
## 参数
19+
20+
| 参数 | 类型 |
21+
| --- | --- |
22+
| option | `Option` |
23+
24+
### Option
25+
26+
| 参数 | 类型 | 必填 | 说明 |
27+
| --- | --- | :---: | --- |
28+
| complete | `(res: TaroGeneral.CallbackResult) => void` || 接口调用结束的回调函数(调用成功、失败都会执行) |
29+
| fail | `(res: TaroGeneral.CallbackResult) => void` || 接口调用失败的回调函数 |
30+
| success | `(result: TaroGeneral.CallbackResult) => void` || 接口调用成功的回调函数 |

docs/apis/route/navigateBack.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ sidebar_label: navigateBack
77

88
支持情况:<img title="微信小程序" src={require('@site/static/img/platform/weapp.png').default} className="icon_platform" width="25px"/> <img title="抖音小程序" src={require('@site/static/img/platform/tt.png').default} className="icon_platform" width="25px"/> <img title="H5" src={require('@site/static/img/platform/h5.png').default} className="icon_platform" width="25px"/> <img title="React Native" src={require('@site/static/img/platform/rn.png').default} className="icon_platform" width="25px"/> <img title="Harmony" src={require('@site/static/img/platform/harmony.png').default} className="icon_platform icon_platform--not-support" width="25px"/>
99

10+
> H5: 若入参 delta 大于现有页面数时,返回应用打开的第一个页面(如果想要返回首页请使用 reLaunch 方法)。
11+
1012
> [参考文档](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateBack.html)
1113
1214
## 类型

docs/components/canvas/canvas.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ class App extends Components {
5757
| type | `string` | || 指定 canvas 类型,支持 2d 和 webgl |
5858
| canvasId | `string` | || canvas 组件的唯一标识符,若指定了 type 则无需再指定该属性 |
5959
| disableScroll | `boolean` | `false` || 当在 canvas 中移动时且有绑定手势事件时,禁止屏幕滚动以及下拉刷新 |
60-
| nativeProps | `Record<string, unknown>` | || 用于透传 `WebComponents` 上的属性到内部 H5 标签上 |
6160
| id | `string` | || 组件唯一标识符。<br />注意:同一页面中的 id 不可重复。 |
6261
| width | `string` | || |
6362
| height | `string` | || |
63+
| nativeProps | `Record<string, unknown>` | || 用于透传 `WebComponents` 上的属性到内部 H5 标签上 |
6464
| onTouchStart | `CanvasTouchEventFunction` | || 手指触摸动作开始 |
6565
| onTouchMove | `CanvasTouchEventFunction` | || 手指触摸后移动 |
6666
| onTouchEnd | `CanvasTouchEventFunction` | || 手指触摸动作结束 |
@@ -77,14 +77,14 @@ class App extends Components {
7777
| CanvasProps.type | ✔️ | | ✔️ | ✔️ | | | | | |
7878
| CanvasProps.canvasId | ✔️ | ✔️ | | ✔️ | ✔️ | ✔️ | ✔️ | | |
7979
| CanvasProps.disableScroll | ✔️ | ✔️ | ✔️ | | ✔️ | ✔️ | | | |
80+
| CanvasProps.id | | | ✔️ | | | | ✔️ | | |
81+
| CanvasProps.width | | | ✔️ | | | | ✔️ | | |
82+
| CanvasProps.height | | | ✔️ | | | | ✔️ | | |
8083
| CanvasProps.nativeProps | | | | | | | ✔️ | | |
81-
| CanvasProps.id | | | ✔️ | | | | | | |
82-
| CanvasProps.width | | | ✔️ | | | | | | |
83-
| CanvasProps.height | | | ✔️ | | | | | | |
84-
| CanvasProps.onTouchStart | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | | |
85-
| CanvasProps.onTouchMove | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | | |
86-
| CanvasProps.onTouchEnd | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | | |
87-
| CanvasProps.onTouchCancel | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | | |
84+
| CanvasProps.onTouchStart | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | |
85+
| CanvasProps.onTouchMove | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | |
86+
| CanvasProps.onTouchEnd | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | |
87+
| CanvasProps.onTouchCancel | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | | |
8888
| CanvasProps.onLongTap | ✔️ | ✔️ | ✔️ | | ✔️ | ✔️ | ✔️ | | |
8989
| CanvasProps.onError | ✔️ | ✔️ | | | ✔️ | ✔️ | | | |
9090
| CanvasProps.onTap | | | ✔️ | | | | | | |

docs/components/forms/button.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ open-type 的合法值
330330

331331
| 参数 | 类型 | 说明 |
332332
| --- | --- | --- |
333-
| weapp | `{ contact: any; share: any; getPhoneNumber: any; getRealtimePhoneNumber: any; getUserInfo: any; launchApp: any; openSetting: any; feedback: any; chooseAvatar: any; agreePrivacyAuthorization: any; }` | |
333+
| weapp | { contact: any; share: any; getPhoneNumber: any; getRealtimePhoneNumber: any; getUserInfo: any; launchApp: any; openSetting: any; feedback: any; chooseAvatar: any; agreePrivacyAuthorization: any; "getPhoneNumberoragreePrivacyAuthorization": any; "getRealtimePhoneNumberoragreePrivacyAuthorization": any; "getUserInfoorag... | |
334334
| alipay | `{ share: any; getAuthorize: any; contactShare: any; lifestyle: any; }` | 支付宝小程序专属的 open-type 合法值<br />[参考地址](https://opendocs.alipay.com/mini/component/button) |
335335
| qq | `{ share: any; getUserInfo: any; launchApp: any; openSetting: any; feedback: any; openGroupProfile: any; addFriend: any; addColorSign: any; openPublicProfile: any; addGroupApp: any; shareMessageToFriend: any; }` | QQ 小程序专属的 open-type 合法值<br />[参考地址](https://q.qq.com/wiki/develop/miniprogram/component/form/button.html) |
336336
| tt | `{ share: any; getPhoneNumber: any; im: any; platformIm: any; navigateToVideoView: any; openAwemeUserProfile: any; openWebcastRoom: any; addCalendarEvent: any; addShortcut: any; joinGroup: any; privateMessage: any; authorizePrivateMessage: any; }` | TT 小程序专属的 open-type 合法值<br />[参考地址](https://developer.open-douyin.com/docs/resource/zh-CN/mini-app/develop/component/list/button/#open-type-%E7%9A%84%E5%90%88%E6%B3%95%E5%80%BC) |

packages/taro-components/types/Button.d.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,21 @@ declare namespace ButtonProps {
338338
* 用户同意隐私协议按钮。可通过 bindagreeprivacyauthorization 监听用户同意隐私协议事件
339339
*/
340340
agreePrivacyAuthorization
341+
/**
342+
* 从基础库 2.32.3 版本起,隐私同意按钮支持与手机号快速验证组件耦合使用,调用方式为:
343+
* <button open-type="getPhoneNumber|agreePrivacyAuthorization">
344+
*/
345+
['getPhoneNumber|agreePrivacyAuthorization']
346+
/**
347+
* 从基础库 2.32.3 版本起,支持隐私同意按钮与手机号实时验证组件耦合使用,调用方式为:
348+
* <button open-type="getRealtimePhoneNumber|agreePrivacyAuthorization">
349+
*/
350+
['getRealtimePhoneNumber|agreePrivacyAuthorization']
351+
/**
352+
* 从基础库 2.32.3 版本起,支持隐私同意按钮与获取用户信息组件耦合使用,调用方式为:
353+
* <button open-type="getUserInfo|agreePrivacyAuthorization">
354+
*/
355+
['getUserInfo|agreePrivacyAuthorization']
341356
}
342357
/** 支付宝小程序专属的 open-type 合法值
343358
* @see https://opendocs.alipay.com/mini/component/button

packages/taro-components/types/Canvas.d.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,37 @@ interface CanvasProps extends StandardProps<any, CanvasTouchEvent> {
1414
* @supported weapp, alipay, swan, qq, jd
1515
*/
1616
disableScroll?: boolean
17-
/** 用于透传 `WebComponents` 上的属性到内部 H5 标签上
18-
* @supported h5
19-
*/
20-
nativeProps?: Record<string, unknown>
2117
/** 组件唯一标识符。
2218
* 注意:同一页面中的 id 不可重复。
23-
* @supported alipay
19+
* @supported alipay, h5
2420
*/
2521
id?: string
2622
/**
27-
* @supported alipay
23+
* @supported alipay, h5
2824
*/
2925
width?: string
3026
/**
31-
* @supported alipay
27+
* @supported alipay, h5
3228
*/
3329
height?: string
30+
/** 用于透传 `WebComponents` 上的属性到内部 H5 标签上
31+
* @supported h5
32+
*/
33+
nativeProps?: Record<string, unknown>
3434
/** 手指触摸动作开始
35-
* @supported weapp, alipay, swan, tt, qq, jd
35+
* @supported weapp, alipay, swan, tt, qq, jd, h5
3636
*/
3737
onTouchStart?: CanvasTouchEventFunction
3838
/** 手指触摸后移动
39-
* @supported weapp, alipay, swan, tt, qq, jd
39+
* @supported weapp, alipay, swan, tt, qq, jd, h5
4040
*/
4141
onTouchMove?: CanvasTouchEventFunction
4242
/** 手指触摸动作结束
43-
* @supported weapp, alipay, swan, tt, qq, jd
43+
* @supported weapp, alipay, swan, tt, qq, jd, h5
4444
*/
4545
onTouchEnd?: CanvasTouchEventFunction
4646
/** 手指触摸动作被打断,如来电提醒,弹窗
47-
* @supported weapp, alipay, swan, tt, qq, jd
47+
* @supported weapp, alipay, swan, tt, qq, jd, h5
4848
*/
4949
onTouchCancel?: CanvasTouchEventFunction
5050
/** 手指长按 500ms 之后触发,触发了长按事件后进行移动不会触发屏幕的滚动

0 commit comments

Comments
 (0)