feat: button组件支持微信小程序的getrealtimephonenumber 事件 (#1097)

This commit is contained in:
湛蓝 2025-09-14 22:36:41 +08:00 committed by GitHub
parent 9585db1150
commit ed412b6726
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 0 deletions

View File

@ -155,6 +155,7 @@
| getUserInfo | 获取用户信息,可以从@getuserinfo 回调中获取到用户信息 |
| contact | 打开客服会话,如果用户在会话中点击消息卡片后返回应用,可以从 @contact 回调中获得具体信息 |
| getPhoneNumber | 获取用户手机号,可以从@getphonenumber 回调中获取到用户信息 |
| getRealtimePhoneNumber | 获取用户手机号,可以从@getrealtimephonenumber 回调中获取到用户信息 |
| launchApp | 小程序中打开 APP可以通过 app-parameter 属性设定向 APP 传的参数 |
| openSetting | 打开授权设置页 |
| chooseAvatar | 获取用户头像,可以从@chooseavatar 回调中获取到头像信息 |
@ -171,6 +172,7 @@
| getuserinfo | 获取用户信息 | `detail` | - |
| contact | 客服消息回调open-type="contact"时有效 | `detail` | - |
| getphonenumber | 获取用户手机号回调open-type=getPhoneNumber 时有效 | `detail` | - |
| getrealtimephonenumber | 实时获取用户手机号回调open-type=getRealtimePhoneNumber 时有效 | `detail` | - |
| error | 当使用开放能力时发生错误的回调open-type=launchApp 时有效 | `detail` | - |
| launchapp | 打开 APP 成功的回调open-type=launchApp 时有效 | `detail` | - |
| opensetting | 在打开授权设置页后回调open-type=openSetting 时有效 | `detail` | - |

View File

@ -20,6 +20,7 @@ export type ButtonOpenType =
| 'getUserInfo'
| 'contact'
| 'getPhoneNumber'
| 'getRealtimePhoneNumber'
| 'launchApp'
| 'openSetting'
| 'chooseAvatar'

View File

@ -32,6 +32,7 @@
@getuserinfo="handleGetuserinfo"
@contact="handleConcat"
@getphonenumber="handleGetphonenumber"
@getrealtimephonenumber="handleGetrealtimephonenumber"
@error="handleError"
@launchapp="handleLaunchapp"
@opensetting="handleOpensetting"
@ -81,6 +82,7 @@ const emit = defineEmits([
'getuserinfo',
'contact',
'getphonenumber',
'getrealtimephonenumber',
'error',
'launchapp',
'opensetting',
@ -134,6 +136,10 @@ function handleGetphonenumber(event: any) {
emit('getphonenumber', event.detail)
}
function handleGetrealtimephonenumber(event: any) {
emit('getrealtimephonenumber', event.detail)
}
function handleError(event: any) {
emit('error', event.detail)
}