Skip to content

Commit

Permalink
fix(Button): eventHandlercatch is changed to bind
Browse files Browse the repository at this point in the history
  • Loading branch information
anlyyao committed May 12, 2023
1 parent 2d13cc6 commit d5c2eb1
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
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

0 comments on commit d5c2eb1

Please sign in to comment.