feat(button): add button-id prop & agreePrivacyAuthorization event support (#5533)

This commit is contained in:
johnsonwong666 2023-08-30 14:41:05 +08:00 committed by GitHub
parent b9dea4fd16
commit fd41bd823a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 21 additions and 6 deletions

View File

@ -120,6 +120,7 @@
| 参数 | 说明 | 类型 | 默认值 | | 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| id | 标识符 | _string_ | - | | id | 标识符 | _string_ | - |
| button-id `v1.10.25`| 标识符作为原生button组件的id值 | _string_ | - |
| type | 按钮类型,可选值为 `primary` `info` `warning` `danger` | _string_ | `default` | | type | 按钮类型,可选值为 `primary` `info` `warning` `danger` | _string_ | `default` |
| size | 按钮尺寸,可选值为 `normal` `large` `small` `mini` | _string_ | `normal` | | size | 按钮尺寸,可选值为 `normal` `large` `small` `mini` | _string_ | `normal` |
| color `v1.0.0` | 按钮颜色,支持传入`linear-gradient`渐变色 | _string_ | - | | color `v1.0.0` | 按钮颜色,支持传入`linear-gradient`渐变色 | _string_ | - |

View File

@ -2,7 +2,7 @@
<wxs src="./index.wxs" module="computed" /> <wxs src="./index.wxs" module="computed" />
<button <button
id="{{ id }}" id="{{ id || buttonId }}"
data-detail="{{ dataset }}" data-detail="{{ dataset }}"
class="custom-class {{ utils.bem('button', [type, size, { block, round, plain, square, loading, disabled, hairline, unclickable: disabled || loading }]) }} {{ hairline ? 'van-hairline--surround' : '' }}" class="custom-class {{ utils.bem('button', [type, size, { block, round, plain, square, loading, disabled, hairline, unclickable: disabled || loading }]) }} {{ hairline ? 'van-hairline--surround' : '' }}"
hover-class="{{ disabled || loading ? '' : 'van-button--active hover-class'}}" hover-class="{{ disabled || loading ? '' : 'van-button--active hover-class'}}"

View File

@ -240,6 +240,7 @@ Page({
| 参数 | 说明 | 类型 | 默认值 | | 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| show | 是否显示弹窗 | _boolean_ | - | | show | 是否显示弹窗 | _boolean_ | - |
| confirm-button-id `v1.10.25`| 确认按钮的标识符作为底层原生button组件的id值 | _string_ | - |
| title | 标题 | _string_ | - | | title | 标题 | _string_ | - |
| width | 弹窗宽度,默认单位为`px` | _string \| number_ | `320px` | | width | 弹窗宽度,默认单位为`px` | _string \| number_ | `320px` |
| message | 文本内容,支持通过`\n`换行 | _string_ | - | | message | 文本内容,支持通过`\n`换行 | _string_ | - |
@ -292,7 +293,7 @@ Page({
| bind:contact | 客服消息回调 | - | | bind:contact | 客服消息回调 | - |
| bind:getphonenumber | 获取用户手机号回调 | - | | bind:getphonenumber | 获取用户手机号回调 | - |
| bind:getrealtimephonenumber `v1.10.21` | 获取手机号实时验证回调open-type=getRealtimePhoneNumber 时有效 | - | | bind:getrealtimephonenumber `v1.10.21` | 获取手机号实时验证回调open-type=getRealtimePhoneNumber 时有效 | - |
| bind:agreeprivacyauthorization `v1.10.24` | 同意隐私协议回调openType="agreePrivacyAuthorization"时有效 | - | | bind:agreeprivacyauthorization `v1.10.25` | 同意隐私协议回调openType="agreePrivacyAuthorization"时有效 | - |
| bind:error | 当使用开放能力时,发生错误的回调 | - | | bind:error | 当使用开放能力时,发生错误的回调 | - |
| bind:opensetting | 在打开授权设置页后回调 | - | | bind:opensetting | 在打开授权设置页后回调 | - |

View File

@ -21,6 +21,7 @@ VantComponent({
type: String, type: String,
value: 'default', value: 'default',
}, },
confirmButtonId: String,
className: String, className: String,
customStyle: String, customStyle: String,
asyncClose: Boolean, asyncClose: Boolean,

View File

@ -46,7 +46,7 @@
loading="{{ loading.confirm }}" loading="{{ loading.confirm }}"
custom-class="van-dialog__confirm confirm-button-class" custom-class="van-dialog__confirm confirm-button-class"
custom-style="color: {{ confirmButtonColor }}" custom-style="color: {{ confirmButtonColor }}"
button-id="{{ confirmButtonId }}"
open-type="{{ confirmButtonOpenType }}" open-type="{{ confirmButtonOpenType }}"
lang="{{ lang }}" lang="{{ lang }}"
business-id="{{ businessId }}" business-id="{{ businessId }}"
@ -56,7 +56,7 @@
send-message-img="{{ sendMessageImg }}" send-message-img="{{ sendMessageImg }}"
show-message-card="{{ showMessageCard }}" show-message-card="{{ showMessageCard }}"
app-parameter="{{ appParameter }}" app-parameter="{{ appParameter }}"
bindagreeprivacyauthorization="onAgreePrivacyAuthorization"
bind:click="onConfirm" bind:click="onConfirm"
bindgetuserinfo="onGetUserInfo" bindgetuserinfo="onGetUserInfo"
bindcontact="onContact" bindcontact="onContact"
@ -96,7 +96,7 @@
loading="{{ loading.confirm }}" loading="{{ loading.confirm }}"
custom-class="van-dialog__confirm confirm-button-class" custom-class="van-dialog__confirm confirm-button-class"
custom-style="color: {{ confirmButtonColor }}" custom-style="color: {{ confirmButtonColor }}"
button-id="{{ confirmButtonId }}"
open-type="{{ confirmButtonOpenType }}" open-type="{{ confirmButtonOpenType }}"
lang="{{ lang }}" lang="{{ lang }}"
business-id="{{ businessId }}" business-id="{{ businessId }}"
@ -106,7 +106,7 @@
send-message-img="{{ sendMessageImg }}" send-message-img="{{ sendMessageImg }}"
show-message-card="{{ showMessageCard }}" show-message-card="{{ showMessageCard }}"
app-parameter="{{ appParameter }}" app-parameter="{{ appParameter }}"
bindagreeprivacyauthorization="onAgreePrivacyAuthorization"
bind:click="onConfirm" bind:click="onConfirm"
bindgetuserinfo="onGetUserInfo" bindgetuserinfo="onGetUserInfo"
bindcontact="onContact" bindcontact="onContact"

View File

@ -1,6 +1,7 @@
<wxs src="../wxs/utils.wxs" module="utils" /> <wxs src="../wxs/utils.wxs" module="utils" />
<van-button <van-button
id="{{ id }}" id="{{ id }}"
button-id="{{ buttonId }}"
lang="{{ lang }}" lang="{{ lang }}"
type="{{ type }}" type="{{ type }}"
size="{{ size }}" size="{{ size }}"
@ -23,6 +24,7 @@
bindcontact="onContact" bindcontact="onContact"
bindopensetting="onOpenSetting" bindopensetting="onOpenSetting"
bindgetuserinfo="onGetUserInfo" bindgetuserinfo="onGetUserInfo"
bindagreeprivacyauthorization="onAgreePrivacyAuthorization"
bindgetphonenumber="onGetPhoneNumber" bindgetphonenumber="onGetPhoneNumber"
bindlaunchapp="onLaunchApp" bindlaunchapp="onLaunchApp"
> >

View File

@ -130,6 +130,7 @@ Page({
| url | 点击后跳转的链接地址 | _string_ | - | | url | 点击后跳转的链接地址 | _string_ | - |
| link-type | 链接跳转类型,可选值为 `redirectTo` `switchTab` `reLaunch` | _string_ | `navigateTo` | | link-type | 链接跳转类型,可选值为 `redirectTo` `switchTab` `reLaunch` | _string_ | `navigateTo` |
| id | 标识符 | _string_ | - | | id | 标识符 | _string_ | - |
| button-id `v1.10.25`| 标识符作为原生button组件的id值 | _string_ | - |
| type | 按钮类型,可选值为 `primary` `warning` `danger` | _string_ | `danger` | | type | 按钮类型,可选值为 `primary` `warning` `danger` | _string_ | `danger` |
| plain | 是否为朴素按钮 | _boolean_ | `false` | | plain | 是否为朴素按钮 | _boolean_ | `false` |
| size | 按钮尺寸,可选值为 `normal` `large` `small` `mini` | _string_ | `normal` | | size | 按钮尺寸,可选值为 `normal` `large` `small` `mini` | _string_ | `normal` |

View File

@ -157,6 +157,7 @@ exports[`should render demo and match snapshot 1`] = `
<van-button <van-button
class="van-goods-action-button van-goods-action-button--warning van-goods-action-button--first" class="van-goods-action-button van-goods-action-button--warning van-goods-action-button--first"
customClass="van-goods-action-button__inner custom-class" customClass="van-goods-action-button__inner custom-class"
bind:agreeprivacyauthorization="onAgreePrivacyAuthorization"
bind:click="onClick" bind:click="onClick"
bind:contact="onContact" bind:contact="onContact"
bind:error="onError" bind:error="onError"
@ -209,6 +210,7 @@ exports[`should render demo and match snapshot 1`] = `
<van-button <van-button
class="van-goods-action-button van-goods-action-button--danger van-goods-action-button--last" class="van-goods-action-button van-goods-action-button--danger van-goods-action-button--last"
customClass="van-goods-action-button__inner custom-class" customClass="van-goods-action-button__inner custom-class"
bind:agreeprivacyauthorization="onAgreePrivacyAuthorization"
bind:click="onClick" bind:click="onClick"
bind:contact="onContact" bind:contact="onContact"
bind:error="onError" bind:error="onError"
@ -490,6 +492,7 @@ exports[`should render demo and match snapshot 1`] = `
<van-button <van-button
class="van-goods-action-button van-goods-action-button--warning van-goods-action-button--first" class="van-goods-action-button van-goods-action-button--warning van-goods-action-button--first"
customClass="van-goods-action-button__inner custom-class" customClass="van-goods-action-button__inner custom-class"
bind:agreeprivacyauthorization="onAgreePrivacyAuthorization"
bind:click="onClick" bind:click="onClick"
bind:contact="onContact" bind:contact="onContact"
bind:error="onError" bind:error="onError"
@ -540,6 +543,7 @@ exports[`should render demo and match snapshot 1`] = `
<van-button <van-button
class="van-goods-action-button van-goods-action-button--danger van-goods-action-button--last" class="van-goods-action-button van-goods-action-button--danger van-goods-action-button--last"
customClass="van-goods-action-button__inner custom-class" customClass="van-goods-action-button__inner custom-class"
bind:agreeprivacyauthorization="onAgreePrivacyAuthorization"
bind:click="onClick" bind:click="onClick"
bind:contact="onContact" bind:contact="onContact"
bind:error="onError" bind:error="onError"
@ -741,6 +745,7 @@ exports[`should render demo and match snapshot 1`] = `
<van-button <van-button
class="van-goods-action-button van-goods-action-button--warning van-goods-action-button--first" class="van-goods-action-button van-goods-action-button--warning van-goods-action-button--first"
customClass="van-goods-action-button__inner custom-class" customClass="van-goods-action-button__inner custom-class"
bind:agreeprivacyauthorization="onAgreePrivacyAuthorization"
bind:click="onClick" bind:click="onClick"
bind:contact="onContact" bind:contact="onContact"
bind:error="onError" bind:error="onError"
@ -791,6 +796,7 @@ exports[`should render demo and match snapshot 1`] = `
<van-button <van-button
class="van-goods-action-button van-goods-action-button--danger van-goods-action-button--last" class="van-goods-action-button van-goods-action-button--danger van-goods-action-button--last"
customClass="van-goods-action-button__inner custom-class" customClass="van-goods-action-button__inner custom-class"
bind:agreeprivacyauthorization="onAgreePrivacyAuthorization"
bind:click="onClick" bind:click="onClick"
bind:contact="onContact" bind:contact="onContact"
bind:error="onError" bind:error="onError"
@ -992,6 +998,7 @@ exports[`should render demo and match snapshot 1`] = `
<van-button <van-button
class="van-goods-action-button van-goods-action-button--warning van-goods-action-button--first" class="van-goods-action-button van-goods-action-button--warning van-goods-action-button--first"
customClass="van-goods-action-button__inner custom-class" customClass="van-goods-action-button__inner custom-class"
bind:agreeprivacyauthorization="onAgreePrivacyAuthorization"
bind:click="onClick" bind:click="onClick"
bind:contact="onContact" bind:contact="onContact"
bind:error="onError" bind:error="onError"
@ -1042,6 +1049,7 @@ exports[`should render demo and match snapshot 1`] = `
<van-button <van-button
class="van-goods-action-button van-goods-action-button--danger van-goods-action-button--last van-goods-action-button--plain" class="van-goods-action-button van-goods-action-button--danger van-goods-action-button--last van-goods-action-button--plain"
customClass="van-goods-action-button__inner custom-class" customClass="van-goods-action-button__inner custom-class"
bind:agreeprivacyauthorization="onAgreePrivacyAuthorization"
bind:click="onClick" bind:click="onClick"
bind:contact="onContact" bind:contact="onContact"
bind:error="onError" bind:error="onError"

View File

@ -5,6 +5,7 @@ export const button = Behavior({
properties: { properties: {
id: String, id: String,
buttonId: String,
lang: String, lang: String,
businessId: Number, businessId: Number,
sessionFrom: String, sessionFrom: String,