Skip to content

Commit

Permalink
fix: 🐛 修复Button为disabled状态时仍能触发open-type指定事件的问题
Browse files Browse the repository at this point in the history
Closes: #458
  • Loading branch information
xuqingkai committed Jul 23, 2024
1 parent 140d960 commit a64a570
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
2 changes: 2 additions & 0 deletions docs/component/button.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@
| app-parameter | 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效 | string | - | - | - |
| show-message-card | 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息,open-type="contact"时有效 | boolean | - | false | - |
| classPrefix | 类名前缀,用于使用自定义图标,参见[icon](/component/icon#自定义图标) | string | - | 'wd-icon' | 0.1.27 |
| button-id | 按钮的唯一标识,可用于设置隐私同意授权按钮的id | string | - | - | $LOWEST_VERSION$ |

## Events

| 事件名称 | 说明 | 参数 | 最低版本 |
Expand Down
16 changes: 9 additions & 7 deletions src/components/wd-privacy-popup/wd-privacy-popup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,19 @@
<text>{{ subDesc }}</text>
</view>
<view class="wd-privacy-popup__footer">
<button class="wd-privacy-popup__footer-disagree wd-button is-block is-round is-medium is-plain" id="disagree-btn" @click="handleDisagree">
<wd-button custom-class="wd-privacy-popup__footer-disagree " size="medium" round plain buttonId="disagree-btn" @click="handleDisagree">
拒绝
</button>
<button
class="wd-privacy-popup__footer-agree wd-button is-primary is-block is-round is-medium"
id="agree-btn"
</wd-button>
<wd-button
class="wd-privacy-popup__footer-agree"
round
size="medium"
buttonId="agree-btn"
open-type="agreePrivacyAuthorization"
@agreeprivacyauthorization="handleAgree"
>
同意
</button>
</wd-button>
</view>
</wd-popup>
</view>
Expand Down Expand Up @@ -51,7 +53,7 @@ interface Props {
withDefaults(defineProps<Props>(), {
title: '用户隐私保护提示',
desc: '感谢您使用本应用,您使用本应用的服务之前请仔细阅读并同意',
subDesc: '当您点击同意并开始时用产品服务时,即表示你已理解并同息该条款内容,该条款将对您产生法律约束力。如您拒绝,将无法使用相应服务。',
subDesc: '当您点击同意并开始使用产品服务时,即表示你已理解并同息该条款内容,该条款将对您产生法律约束力。如您拒绝,将无法使用相应服务。',
protocol: '《用户隐私保护指引》'
})
const emit = defineEmits(['agree', 'disagree'])
Expand Down
11 changes: 7 additions & 4 deletions src/uni_modules/wot-design-uni/components/wd-button/types.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* @Author: weisheng
* @Date: 2024-03-15 11:36:12
* @LastEditTime: 2024-07-19 21:31:44
* @LastEditTime: 2024-07-23 11:38:09
* @LastEditors: weisheng
* @Description:
* @FilePath: /wot-design-uni/src/uni_modules/wot-design-uni/components/wd-button/types.ts
* @FilePath: \wot-design-uni\src\uni_modules\wot-design-uni\components\wd-button\types.ts
* 记得注释
*/
import type { ExtractPropTypes } from 'vue'
Expand Down Expand Up @@ -63,7 +63,6 @@ export const buttonProps = {
* 开放能力
*/
openType: String,
formType: String,
/**
* 指定是否阻止本节点的祖先节点出现点击态
*/
Expand Down Expand Up @@ -95,7 +94,11 @@ export const buttonProps = {
/**
* 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息,open-type="contact"时有效
*/
showMessageCard: Boolean
showMessageCard: Boolean,
/**
* 按钮的唯一标识,可用于设置隐私同意授权按钮的id
*/
buttonId: String
}

export type ButtonProps = ExtractPropTypes<typeof buttonProps>
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<button
:id="buttonId"
:hover-class="`${disabled || loading ? '' : 'wd-button--active'}`"
:style="customStyle"
:class="[
Expand All @@ -16,7 +17,7 @@
]"
:hover-start-time="hoverStartTime"
:hover-stay-time="hoverStayTime"
:open-type="openType"
:open-type="disabled || loading ? '' : openType"
:send-message-title="sendMessageTitle"
:send-message-path="sendMessagePath"
:send-message-img="sendMessageImg"
Expand All @@ -25,7 +26,6 @@
:session-from="sessionFrom"
:lang="lang"
:hover-stop-propagation="hoverStopPropagation"
:form-type="formType"
@click="handleClick"
@getuserinfo="handleGetuserinfo"
@contact="handleConcat"
Expand Down

0 comments on commit a64a570

Please sign in to comment.