From 045f2b4c03416c788f07c30b26067b3d39cc9369 Mon Sep 17 00:00:00 2001 From: GPPoseidon <1335734732@qq.com> Date: Fri, 13 Dec 2019 10:27:58 +0800 Subject: [PATCH] docs(notice-bar): add notice-bar example (#2523) --- example/pages/notice-bar/index.js | 8 +++++++- example/pages/notice-bar/index.wxml | 16 +++++++++++++++- packages/notice-bar/README.md | 10 ++++++++++ packages/notice-bar/index.ts | 3 +++ 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/example/pages/notice-bar/index.js b/example/pages/notice-bar/index.js index 691ec4bd..8cb36092 100644 --- a/example/pages/notice-bar/index.js +++ b/example/pages/notice-bar/index.js @@ -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 + }); } }); diff --git a/example/pages/notice-bar/index.wxml b/example/pages/notice-bar/index.wxml index 17f86774..06a9f7ab 100644 --- a/example/pages/notice-bar/index.wxml +++ b/example/pages/notice-bar/index.wxml @@ -23,4 +23,18 @@ [公告] [结束] - \ No newline at end of file + + + + + 当前速度{{speedValue}}px/s + + diff --git a/packages/notice-bar/README.md b/packages/notice-bar/README.md index 6db5ddd4..818b39b8 100644 --- a/packages/notice-bar/README.md +++ b/packages/notice-bar/README.md @@ -68,6 +68,16 @@ text="足协杯战线连续第2年上演广州德比战,上赛季半决赛上恒大以两回合5-3的总比分淘汰富力。" /> ``` +### 自定义滚动速率 +使用`speed`属性控制滚动速率 + +```html + +``` ## API diff --git a/packages/notice-bar/index.ts b/packages/notice-bar/index.ts index 66ef08da..f8a2e9c2 100644 --- a/packages/notice-bar/index.ts +++ b/packages/notice-bar/index.ts @@ -56,6 +56,9 @@ VantComponent({ watch: { text() { this.setData({}, this.init); + }, + speed() { + this.setData({}, this.init); } },