docs(notice-bar): add notice-bar example (#2523)

This commit is contained in:
GPPoseidon 2019-12-13 10:27:58 +08:00 committed by rex
parent a5e56d43e8
commit 045f2b4c03
4 changed files with 35 additions and 2 deletions

View File

@ -2,6 +2,12 @@ import Page from '../../common/page';
Page({
data: {
text: '足协杯战线连续第2年上演广州德比战上赛季半决赛上恒大以两回合5-3的总比分淘汰富力。'
text: '足协杯战线连续第2年上演广州德比战上赛季半决赛上恒大以两回合5-3的总比分淘汰富力。',
speedValue: 80
},
onChange(event) {
this.setData({
speedValue: event.detail
});
}
});

View File

@ -23,4 +23,18 @@
<text slot="left-icon">[公告]</text>
<text slot="right-icon">[结束]</text>
</van-notice-bar>
</demo-block>
</demo-block>
<demo-block title="自定义滚动速率">
<van-notice-bar
text="{{ text }}"
speed="{{speedValue}}"
left-icon="//img.yzcdn.cn/public_files/2017/8/10/6af5b7168eed548100d9041f07b7c616.png"
/>
当前速度{{speedValue}}px/s
<van-slider
value="{{speedValue}}"
custom-class="slider"
bind:change="onChange"
/>
</demo-block>

View File

@ -68,6 +68,16 @@
text="足协杯战线连续第2年上演广州德比战上赛季半决赛上恒大以两回合5-3的总比分淘汰富力。"
/>
```
### 自定义滚动速率
使用`speed`属性控制滚动速率
```html
<van-notice-bar
text="{{ text }}"
speed="{{speedValue}}"
left-icon="//img.yzcdn.cn/public_files/2017/8/10/6af5b7168eed548100d9041f07b7c616.png"
/>
```
## API

View File

@ -56,6 +56,9 @@ VantComponent({
watch: {
text() {
this.setData({}, this.init);
},
speed() {
this.setData({}, this.init);
}
},