From e74592f26aacc56ef69a76fb7e6225cd5022b82b Mon Sep 17 00:00:00 2001 From: neverland Date: Wed, 3 Jun 2020 21:05:15 +0800 Subject: [PATCH] docs(NoticeBar): add vertical scroll demo (#6455) --- src/notice-bar/README.md | 24 +++++++++++++ src/notice-bar/README.zh-CN.md | 36 ++++++++++++++++--- src/notice-bar/demo/index.vue | 36 +++++++++++++++---- .../test/__snapshots__/demo.spec.js.snap | 16 +++++++++ 4 files changed, 102 insertions(+), 10 deletions(-) diff --git a/src/notice-bar/README.md b/src/notice-bar/README.md index bcf2c72ad..14efc979a 100644 --- a/src/notice-bar/README.md +++ b/src/notice-bar/README.md @@ -53,6 +53,30 @@ Vue.use(NoticeBar); ``` +### Vertical Scroll + +```html + + + Content 1 + Content 2 + Content 3 + + + + +``` + ## API ### Props diff --git a/src/notice-bar/README.zh-CN.md b/src/notice-bar/README.zh-CN.md index 1dc2f4d26..5b83d26ae 100644 --- a/src/notice-bar/README.zh-CN.md +++ b/src/notice-bar/README.zh-CN.md @@ -19,7 +19,7 @@ Vue.use(NoticeBar); ### 禁用滚动 -文字内容多于一行时,可通过`scrollable`参数控制是否开启滚动 +文字内容多于一行时,可通过 `scrollable` 参数控制是否开启滚动。 ```html @@ -29,7 +29,7 @@ Vue.use(NoticeBar); ### 多行展示 -禁用滚动时,可以设置`wrapable`来开启多行展示 +禁用滚动时,可以设置 `wrapable` 来开启多行展示。 ```html @@ -39,7 +39,7 @@ Vue.use(NoticeBar); ### 通知栏模式 -默认模式为空,支持`closeable`和`link`两种模式 +默认模式为空,支持 `closeable` 和 `link` 两种模式。 ```html @@ -55,12 +55,40 @@ Vue.use(NoticeBar); ### 自定义样式 +通过 `color` 属性设置文本颜色,通过 `background` 属性设置背景色。 + ```html 通知内容 ``` +### 垂直滚动 + +搭配 NoticeBar 和 Swipe 组件可以实现垂直滚动的效果。 + +```html + + + 内容 1 + 内容 2 + 内容 3 + + + + +``` + ## API ### Props @@ -69,7 +97,7 @@ Vue.use(NoticeBar); | --- | --- | --- | --- | | mode | 通知栏模式,可选值为 `closeable` `link` | _string_ | `''` | | text | 通知文本内容 | _string_ | `''` | -| color | 文本颜色 | _string_ | `#f60` | +| color | 通知文本颜色 | _string_ | `#f60` | | background | 滚动条背景 | _string_ | `#fff7cc` | | left-icon | 左侧[图标名称](#/zh-CN/icon)或图片链接 | _string_ | - | | delay | 动画延迟时间 (s) | _number \| string_ | `1` | diff --git a/src/notice-bar/demo/index.vue b/src/notice-bar/demo/index.vue index 483bc8474..683516d08 100644 --- a/src/notice-bar/demo/index.vue +++ b/src/notice-bar/demo/index.vue @@ -25,6 +25,21 @@ left-icon="info-o" /> + + + + + {{ t('content') }} 1 + {{ t('content') }} 2 + {{ t('content') }} 3 + + + @@ -32,20 +47,24 @@ export default { i18n: { 'zh-CN': { - unscrollable: '禁用滚动', - mode: '通知栏模式', - wrapable: '多行展示', text: '足协杯战线连续第2年上演广州德比战,上赛季半决赛上恒大以两回合5-3的总比分淘汰富力。', + mode: '通知栏模式', + content: '内容', + wrapable: '多行展示', + unscrollable: '禁用滚动', customStyle: '自定义样式', + verticalScroll: '垂直滚动', }, 'en-US': { - mode: 'Mode', - wrapable: 'Wrapable', - unscrollable: 'Disable scroll', text: 'Only those who have the patience to do simple things perfectly ever acquire the skill to do difficult things easily.', + mode: 'Mode', + content: 'Content', + wrapable: 'Wrapable', customStyle: 'Custom Style', + unscrollable: 'Disable scroll', + verticalScroll: 'Vertical Scroll', }, }, }; @@ -64,5 +83,10 @@ export default { .van-doc-demo-block__title { padding-top: 24px; } + + .notice-swipe { + height: 40px; + line-height: 40px; + } } diff --git a/src/notice-bar/test/__snapshots__/demo.spec.js.snap b/src/notice-bar/test/__snapshots__/demo.spec.js.snap index 8850bc726..c2cf6cbff 100644 --- a/src/notice-bar/test/__snapshots__/demo.spec.js.snap +++ b/src/notice-bar/test/__snapshots__/demo.spec.js.snap @@ -46,5 +46,21 @@ exports[`renders demo correctly 1`] = ` +
+ +
`;