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 #2373

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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: SwiperChangeSource)` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/swiper/type.ts)。<br/>`type SwiperChangeSource = 'autoplay' \| 'touch' \| 'nav'`<br/>


### 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: SwiperChangeSource)` | 当 `direction="vertical"` 时轮播切换时触发。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/swiper/type.ts)。<br/>`type SwiperChangeSource = 'autoplay' \| 'touch' \| 'nav'`<br/>
betavs marked this conversation as resolved.
Show resolved Hide resolved

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

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

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
Loading