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

feat(SwipeCell): add click event param #5679

Open
wants to merge 1 commit into
base: dev
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
2 changes: 1 addition & 1 deletion packages/swipe-cell/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ Page({

| 事件名 | 说明 | 参数 |
| --- | --- | --- |
| bind:click | 点击时触发 | 关闭时的点击位置 (`left` `right` `cell` `outside`) |
| bind:click | 点击时触发 | { position: 关闭时的点击位置 (`left` `right` `cell` `outside`), offset: 偏移量 (offset > 0 代表左侧显示,offset < 0 代表右侧显示)} |
| bind:close | 关闭时触发 | { position: 'left' \| 'right' , instance , name: string } |
| bind:open | 打开时触发 | { position: 'left' \| 'right' , name: string } |

Expand Down
12 changes: 7 additions & 5 deletions packages/swipe-cell/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ VantComponent({

this.dragging = true;

ARRAY.filter(
(item) => item !== this && item.offset !== 0
).forEach((item) => item.close());
ARRAY.filter((item) => item !== this && item.offset !== 0).forEach(
(item) => item.close()
);

this.setData({ catchMove: true });
this.swipeMove(this.startOffset + this.deltaX);
Expand All @@ -140,8 +140,10 @@ VantComponent({

onClick(event: WechatMiniprogram.TouchEvent) {
const { key: position = 'outside' } = event.currentTarget.dataset;
this.$emit('click', position);

this.$emit('click', {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

属于 break change,不能这么改

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的 left 或者 right 不能判断出是那边显示出来的吗

position,
offset: this.offset,
});
if (!this.offset) {
return;
}
Expand Down
Loading