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(notice-bar): enable event change #2492

Merged
merged 3 commits into from
Dec 14, 2023
Merged
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
1 change: 1 addition & 0 deletions src/notice-bar/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ default-visible | Boolean | false | uncontrolled property | N
name | params | description
-- | -- | --
click | `(trigger: NoticeBarTrigger)` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/notice-bar/type.ts)。<br/>`type NoticeBarTrigger = 'prefix-icon' \| 'content' \| 'operation' \| 'suffix-icon';`<br/>
change | `(current: number, source: '' \| 'autoplay' \| 'touch')` | `direction="vertical"`


### CSS Variables
Expand Down
1 change: 1 addition & 0 deletions src/notice-bar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ default-visible | Boolean | false | 显示/隐藏。非受控属性 | N
名称 | 参数 | 描述
-- | -- | --
click | `(trigger: NoticeBarTrigger)` | 点击事件。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/notice-bar/type.ts)。<br/>`type NoticeBarTrigger = 'prefix-icon' \| 'content' \| 'operation' \| 'suffix-icon';`<br/>
change | `(current: number, source: '' \| 'autoplay' \| 'touch')` | 当 `direction="vertical"` 时轮播切换时触发

### NoticeBar 外部样式类
类名 | 说明
Expand Down
5 changes: 5 additions & 0 deletions src/notice-bar/notice-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ export default class NoticeBar extends SuperComponent {
});
},

onChange(e: WechatMiniprogram.SwiperChange) {
const { current, source } = e.detail;
this.triggerEvent('change', { current, source });
},

clickPrefixIcon() {
this.triggerEvent('click', { trigger: 'prefix-icon' });
},
Expand Down
1 change: 1 addition & 0 deletions src/notice-bar/notice-bar.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
interval="{{interval}}"
display-multiple-items="1"
class="{{classPrefix}}__content--vertical"
bindchange="onChange"
>
<block wx:for="{{content}}" wx:key="index">
<swiper-item>
Expand Down