From 7b0546dbba7425988ae2b4d1765fe20e907c893f Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Thu, 11 Jun 2020 16:33:48 +0800 Subject: [PATCH] feat(NoticeBar): allow to force scrolling --- src/notice-bar/README.md | 15 ++++--- src/notice-bar/README.zh-CN.md | 42 ++++++++++++------- src/notice-bar/demo/index.vue | 23 +++++----- src/notice-bar/index.js | 6 +-- .../test/__snapshots__/demo.spec.js.snap | 17 +++++--- .../test/__snapshots__/index.spec.js.snap | 6 +-- 6 files changed, 66 insertions(+), 43 deletions(-) diff --git a/src/notice-bar/README.md b/src/notice-bar/README.md index 14efc979a..d7dc29137 100644 --- a/src/notice-bar/README.md +++ b/src/notice-bar/README.md @@ -17,12 +17,17 @@ Vue.use(NoticeBar); ``` -### Disable scroll +### Scrollable ```html - - Notice Content - + + + + + ``` ### Wrapable @@ -90,7 +95,7 @@ Vue.use(NoticeBar); | left-icon | Left Icon | _string_ | - | | delay | Animation delay (s) | _number \| string_ | `1` | | speed | Scroll speed (px/s) | _number \| string_ | `50` | -| scrollable | Whether to scroll content | _boolean_ | `true` | +| scrollable | Whether to scroll content | _boolean_ | - | | wrapable | Whether to enable text wrap | _boolean_ | `false` | - | ### Events diff --git a/src/notice-bar/README.zh-CN.md b/src/notice-bar/README.zh-CN.md index 5b83d26ae..eb5fc8cb7 100644 --- a/src/notice-bar/README.zh-CN.md +++ b/src/notice-bar/README.zh-CN.md @@ -13,43 +13,55 @@ Vue.use(NoticeBar); ### 基础用法 +通过 `text` 属性设置通知栏的内容,通过 `left-icon` 属性设置通知栏左侧的图标。 + ```html - + ``` -### 禁用滚动 +### 滚动播放 -文字内容多于一行时,可通过 `scrollable` 参数控制是否开启滚动。 +通知栏的内容长度溢出时会自动开启滚动播放,通过 `scrollable` 属性可以控制该行为。 ```html - - 通知内容 - + + + + + ``` ### 多行展示 -禁用滚动时,可以设置 `wrapable` 来开启多行展示。 +文字较长时,可以通过设置 `wrapable` 属性来开启多行展示。 ```html - - 通知内容 - + ``` ### 通知栏模式 -默认模式为空,支持 `closeable` 和 `link` 两种模式。 +通知栏支持 `closeable` 和 `link` 两种模式。 ```html - 通知内容 + 技术是开发它的人的共同灵魂。 - 通知内容 + 技术是开发它的人的共同灵魂。 ``` @@ -59,7 +71,7 @@ Vue.use(NoticeBar); ```html - 通知内容 + 技术是开发它的人的共同灵魂。 ``` @@ -102,7 +114,7 @@ Vue.use(NoticeBar); | left-icon | 左侧[图标名称](#/zh-CN/icon)或图片链接 | _string_ | - | | delay | 动画延迟时间 (s) | _number \| string_ | `1` | | speed | 滚动速率 (px/s) | _number \| string_ | `50` | -| scrollable | 是否在长度溢出时滚动播放 | _boolean_ | `true` | +| scrollable | 是否开启滚动播放,内容长度溢出时默认开启 | _boolean_ | - | | wrapable | 是否开启文本换行,只在禁用滚动时生效 | _boolean_ | `false` | ### Events diff --git a/src/notice-bar/demo/index.vue b/src/notice-bar/demo/index.vue index 683516d08..2e9c385a2 100644 --- a/src/notice-bar/demo/index.vue +++ b/src/notice-bar/demo/index.vue @@ -1,10 +1,11 @@