Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Button): eventHandlercatch is changed to bind #1988

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/button/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,6 @@ bindchooseavatar | Eventhandle | - | 获取用户头像回调,open-type=choose

名称 | 参数 | 描述
-- | -- | --
tap | `event` | 点击按钮,当按钮不为加载或禁用状态时触发
tap | `event` | (即将废弃,建议使用 `click`)点击按钮,当按钮不为加载或禁用状态时触发
click | `event` | 点击按钮,当按钮不为加载或禁用状态时触发

1 change: 1 addition & 0 deletions src/button/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export default class Button extends SuperComponent {
handleTap(e) {
if (this.data.disabled || this.data.loading) return;

this.triggerEvent('click', e);
this.triggerEvent('tap', e);
},
};
Expand Down
2 changes: 1 addition & 1 deletion src/button/button.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
send-message-img="{{sendMessageImg}}"
app-parameter="{{appParameter}}"
show-message-card="{{showMessageCard}}"
catch:tap="handleTap"
bind:tap="handleTap"
bind:getuserinfo="getuserinfo"
bind:contact="contact"
bind:getphonenumber="getphonenumber"
Expand Down
2 changes: 1 addition & 1 deletion src/calendar/__test__/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ exports[`calendar :base 1`] = `
bind:getuserinfo="getuserinfo"
bind:launchapp="launchapp"
bind:opensetting="opensetting"
catch:tap="handleTap"
bind:tap="handleTap"
>
<wx-view
class="t-button__content"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ exports[`calendar :base 1`] = `
bind:getuserinfo="getuserinfo"
bind:launchapp="launchapp"
bind:opensetting="opensetting"
catch:tap="handleTap"
bind:tap="handleTap"
>
<wx-view
class="t-button__content"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exports[`ImageViewer ImageViewer base demo works fine 1`] = `
size="large"
theme="primary"
variant="outline"
bind:tap="clickHandle"
bind:tap="onClick"
>
基础图片预览
</t-button>
Expand All @@ -34,12 +34,12 @@ exports[`ImageViewer ImageViewer delete demo works fine 1`] = `
size="large"
theme="primary"
variant="outline"
bind:tap="clickHandle"
bind:tap="onClick"
>
带操作图片预览
</t-button>
<t-toast
id="t-toast"
<t-action-sheet
id="t-action-sheet"
/>
<t-image-viewer
closeBtn="{{false}}"
Expand Down