Skip to content

Commit a64a570

Browse files
author
xuqingkai
committed
fix: 🐛 修复Button为disabled状态时仍能触发open-type指定事件的问题
Closes: #458
1 parent 140d960 commit a64a570

File tree

4 files changed

+20
-13
lines changed

4 files changed

+20
-13
lines changed

docs/component/button.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@
119119
| app-parameter | 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效 | string | - | - | - |
120120
| show-message-card | 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息,open-type="contact"时有效 | boolean | - | false | - |
121121
| classPrefix | 类名前缀,用于使用自定义图标,参见[icon](/component/icon#自定义图标) | string | - | 'wd-icon' | 0.1.27 |
122+
| button-id | 按钮的唯一标识,可用于设置隐私同意授权按钮的id | string | - | - | $LOWEST_VERSION$ |
123+
122124
## Events
123125

124126
| 事件名称 | 说明 | 参数 | 最低版本 |

src/components/wd-privacy-popup/wd-privacy-popup.vue

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,19 @@
1111
<text>{{ subDesc }}</text>
1212
</view>
1313
<view class="wd-privacy-popup__footer">
14-
<button class="wd-privacy-popup__footer-disagree wd-button is-block is-round is-medium is-plain" id="disagree-btn" @click="handleDisagree">
14+
<wd-button custom-class="wd-privacy-popup__footer-disagree " size="medium" round plain buttonId="disagree-btn" @click="handleDisagree">
1515
拒绝
16-
</button>
17-
<button
18-
class="wd-privacy-popup__footer-agree wd-button is-primary is-block is-round is-medium"
19-
id="agree-btn"
16+
</wd-button>
17+
<wd-button
18+
class="wd-privacy-popup__footer-agree"
19+
round
20+
size="medium"
21+
buttonId="agree-btn"
2022
open-type="agreePrivacyAuthorization"
2123
@agreeprivacyauthorization="handleAgree"
2224
>
2325
同意
24-
</button>
26+
</wd-button>
2527
</view>
2628
</wd-popup>
2729
</view>
@@ -51,7 +53,7 @@ interface Props {
5153
withDefaults(defineProps<Props>(), {
5254
title: '用户隐私保护提示',
5355
desc: '感谢您使用本应用,您使用本应用的服务之前请仔细阅读并同意',
54-
subDesc: '当您点击同意并开始时用产品服务时,即表示你已理解并同息该条款内容,该条款将对您产生法律约束力。如您拒绝,将无法使用相应服务。',
56+
subDesc: '当您点击同意并开始使用产品服务时,即表示你已理解并同息该条款内容,该条款将对您产生法律约束力。如您拒绝,将无法使用相应服务。',
5557
protocol: '《用户隐私保护指引》'
5658
})
5759
const emit = defineEmits(['agree', 'disagree'])

src/uni_modules/wot-design-uni/components/wd-button/types.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/*
22
* @Author: weisheng
33
* @Date: 2024-03-15 11:36:12
4-
* @LastEditTime: 2024-07-19 21:31:44
4+
* @LastEditTime: 2024-07-23 11:38:09
55
* @LastEditors: weisheng
66
* @Description:
7-
* @FilePath: /wot-design-uni/src/uni_modules/wot-design-uni/components/wd-button/types.ts
7+
* @FilePath: \wot-design-uni\src\uni_modules\wot-design-uni\components\wd-button\types.ts
88
* 记得注释
99
*/
1010
import type { ExtractPropTypes } from 'vue'
@@ -63,7 +63,6 @@ export const buttonProps = {
6363
* 开放能力
6464
*/
6565
openType: String,
66-
formType: String,
6766
/**
6867
* 指定是否阻止本节点的祖先节点出现点击态
6968
*/
@@ -95,7 +94,11 @@ export const buttonProps = {
9594
/**
9695
* 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息,open-type="contact"时有效
9796
*/
98-
showMessageCard: Boolean
97+
showMessageCard: Boolean,
98+
/**
99+
* 按钮的唯一标识,可用于设置隐私同意授权按钮的id
100+
*/
101+
buttonId: String
99102
}
100103

101104
export type ButtonProps = ExtractPropTypes<typeof buttonProps>

src/uni_modules/wot-design-uni/components/wd-button/wd-button.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<template>
22
<button
3+
:id="buttonId"
34
:hover-class="`${disabled || loading ? '' : 'wd-button--active'}`"
45
:style="customStyle"
56
:class="[
@@ -16,7 +17,7 @@
1617
]"
1718
:hover-start-time="hoverStartTime"
1819
:hover-stay-time="hoverStayTime"
19-
:open-type="openType"
20+
:open-type="disabled || loading ? '' : openType"
2021
:send-message-title="sendMessageTitle"
2122
:send-message-path="sendMessagePath"
2223
:send-message-img="sendMessageImg"
@@ -25,7 +26,6 @@
2526
:session-from="sessionFrom"
2627
:lang="lang"
2728
:hover-stop-propagation="hoverStopPropagation"
28-
:form-type="formType"
2929
@click="handleClick"
3030
@getuserinfo="handleGetuserinfo"
3131
@contact="handleConcat"

0 commit comments

Comments
 (0)