Skip to content

Commit

Permalink
refactor(types): sync components types
Browse files Browse the repository at this point in the history
  • Loading branch information
ZakaryCode committed Aug 27, 2023
1 parent ec2051b commit 7832286
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
5 changes: 5 additions & 0 deletions docs/components/forms/button.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ export default {
| shareMessageFriendInfo | `string` | || 发送对象的 FriendInfo |
| shareMessageTitle | `string` | || 转发标题,不传则默认使用当前小程序的昵称。 FriendInfo |
| shareMessageImg | `string` | || 转发显示图片的链接,可以是网络图片路径(仅 QQ CDN 域名路径)或本地图片文件路径或相对代码包根目录的图片文件路径。显示图片长宽比是 5:4FriendInfo |
| dataAwemeId | `string` | || 跳转抖音号个人页,只支持小程序绑定的品牌号、员工号、合作号 |
| onGetUserInfo | `CommonEventFunction<onGetUserInfoEventDetail>` | || 用户点击该按钮时,会返回获取到的用户信息,回调的detail数据与 Taro.getUserInfo 返回的一致<br /><br />生效时机: `open-type="getUserInfo"` |
| onGetAuthorize | `CommonEventFunction` | || 支付宝获取会员基础信息授权回调<br /><br />生效时机:`open-type="getAuthorize"` |
| onContact | `CommonEventFunction<onContactEventDetail>` | || 客服消息回调<br /><br />生效时机:`open-type="contact"` |
Expand All @@ -232,6 +233,7 @@ export default {
| onSubscribe | `CommonEventFunction` | || 订阅消息授权回调,和 open-type 搭配使用,使用时机:open-type="subscribe" |
| onAddFriend | `CommonEventFunction` | || 添加好友的回调 |
| onAddGroupApp | `CommonEventFunction` | || 添加群应用的回调。errCode 错误码:41004(当前用户非管理员或群主,无权操作),41005(超过可添加群应用的群数量) |
| onOpenAwemeUserProfile | `CommonEventFunction` | || 监听跳转抖音号个人页的回调<br /><br />生效时机:`open-type="openAwemeUserProfile"` |

### API 支持度

Expand Down Expand Up @@ -269,6 +271,7 @@ export default {
| ButtonProps.shareMessageFriendInfo | | | | | ✔️ | | | | |
| ButtonProps.shareMessageTitle | | | | | ✔️ | | | | |
| ButtonProps.shareMessageImg | | | | | ✔️ | | | | |
| ButtonProps.dataAwemeId | | | | ✔️ | | | | | |
| ButtonProps.onGetUserInfo | ✔️ | ✔️ | ✔️ | | ✔️ | ✔️ | | | |
| ButtonProps.onGetAuthorize | | | ✔️ | | | | | | |
| ButtonProps.onContact | ✔️ | ✔️ | | | ✔️ | | | | |
Expand All @@ -287,6 +290,7 @@ export default {
| ButtonProps.onSubscribe | | ✔️ | | | | | | | |
| ButtonProps.onAddFriend | | | | | ✔️ | | | | |
| ButtonProps.onAddGroupApp | | | | | ✔️ | | | | |
| ButtonProps.onOpenAwemeUserProfile | | | | ✔️ | | | | | |

### Size

Expand Down Expand Up @@ -329,6 +333,7 @@ open-type 的合法值
| weapp | `{ contact: any; share: any; getPhoneNumber: any; getRealtimePhoneNumber: any; getUserInfo: any; launchApp: any; openSetting: any; feedback: any; chooseAvatar: any; agreePrivacyAuthorization: any; }` | |
| alipay | `{ share: any; getAuthorize: any; contactShare: any; lifestyle: any; }` | 支付宝小程序专属的 open-type 合法值<br />[参考地址](https://opendocs.alipay.com/mini/component/button) |
| 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) |
| 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) |

### Lang

Expand Down
41 changes: 40 additions & 1 deletion packages/taro-components/types/Button.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ interface ButtonProps extends StandardProps {
* @supported qq
*/
shareMessageImg?: string
/** 跳转抖音号个人页,只支持小程序绑定的品牌号、员工号、合作号
* @supported tt
*/
dataAwemeId?: string
/** 用户点击该按钮时,会返回获取到的用户信息,回调的detail数据与 Taro.getUserInfo 返回的一致
*
* 生效时机: `open-type="getUserInfo"`
Expand Down Expand Up @@ -261,6 +265,12 @@ interface ButtonProps extends StandardProps {
* @supported qq
*/
onAddGroupApp?: CommonEventFunction
/** 监听跳转抖音号个人页的回调
*
* 生效时机:`open-type="openAwemeUserProfile"`
* @supported tt
*/
onOpenAwemeUserProfile?: CommonEventFunction
}
declare namespace ButtonProps {
/** size 的合法值 */
Expand All @@ -287,7 +297,7 @@ declare namespace ButtonProps {
reset
}
/** open-type 的合法值 */
type OpenType = keyof openTypeKeys['weapp'] | keyof openTypeKeys['alipay'] | keyof openTypeKeys['qq']
type OpenType = keyof openTypeKeys['weapp'] | keyof openTypeKeys['alipay'] | keyof openTypeKeys['qq'] | keyof openTypeKeys['tt']
/** open-type 的合法值 */
interface openTypeKeys {
weapp: {
Expand Down Expand Up @@ -369,6 +379,35 @@ declare namespace ButtonProps {
/** 在自定义开放数据域组件中,向指定好友发起分享据 */
shareMessageToFriend
}
/** TT 小程序专属的 open-type 合法值
* @see 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
*/
tt: {
/** 触发用户转发, 可以配合 data-channel 属性来设置分享的 channel,具体请参考 ShareParam */
share
/** 获取用户手机号,可以从 bindgetphonenumber 回调中获取到用户信息,详情请参见获取手机号 */
getPhoneNumber
/** 跳转到抖音IM客服,详情请参见抖音IM客服能力 */
im
/** 跳转到抖音平台客服,详情请参见平台客服能力 */
platformIm
/** 跳转视频播放页,详情请参见跳转视频播放页 */
navigateToVideoView
/** 跳转抖音号个人页,详情请参见跳转抖音号个人页 */
openAwemeUserProfile
/** 跳转抖音直播间,详情请参见跳转抖音直播间 */
openWebcastRoom
/** 写入系统日历,详情请参见写入系统日历 */
addCalendarEvent
/** 添加到桌面,详情请参见添加到桌面 */
addShortcut
/** 加群,详情请参见加群 */
joinGroup
/** 私信,详情请参见私信 */
privateMessage
/** 主动授权私信,详情请参见主动授权私信 */
authorizePrivateMessage
}
}
/** lang 的合法值 */
interface Lang {
Expand Down

0 comments on commit 7832286

Please sign in to comment.