From ce225ea18bdb451afb140c5ddc92fffe12dc0324 Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 16 Dec 2018 16:07:40 +0800 Subject: [PATCH] [new feature] NoticeBar: support use inner icon (#2305) --- packages/notice-bar/demo/index.vue | 2 +- packages/notice-bar/en-US.md | 5 ++--- packages/notice-bar/index.less | 11 +++-------- packages/notice-bar/index.vue | 9 ++++----- .../notice-bar/test/__snapshots__/demo.spec.js.snap | 7 ++++--- packages/notice-bar/zh-CN.md | 4 ++-- 6 files changed, 16 insertions(+), 22 deletions(-) diff --git a/packages/notice-bar/demo/index.vue b/packages/notice-bar/demo/index.vue index 2ba2c3e3a..ec31da013 100644 --- a/packages/notice-bar/demo/index.vue +++ b/packages/notice-bar/demo/index.vue @@ -3,7 +3,7 @@ diff --git a/packages/notice-bar/en-US.md b/packages/notice-bar/en-US.md index 6d05070ef..8e5d8c793 100644 --- a/packages/notice-bar/en-US.md +++ b/packages/notice-bar/en-US.md @@ -14,7 +14,7 @@ Vue.use(NoticeBar); ```html ``` @@ -46,11 +46,10 @@ Vue.use(NoticeBar); | delay | Animation delay (s) | `Number` | `1` | | speed | Scroll speed (px/s) | `Number` | `50` | | scrollable | Whether to scroll content | `Boolean` | `true` | -| left-icon | Image url of left icon | `String` | - | +| left-icon | Left Icon | `String` | - | | color | Text color | `String` | `#f60` | | background | Background color | `String` | `#fff7cc` | - ### Event | Event | Description | Arguments | diff --git a/packages/notice-bar/index.less b/packages/notice-bar/index.less index 6054df6f0..7583d52e0 100644 --- a/packages/notice-bar/index.less +++ b/packages/notice-bar/index.less @@ -17,21 +17,16 @@ } &__left-icon { - height: 18px; + font-size: 16px; min-width: 20px; - box-sizing: border-box; - - img { - width: 16px; - height: 16px; - } } &__right-icon { - top: 12px; + top: 50%; right: 15px; font-size: 16px; position: absolute; + margin-top: -0.5em; } &__wrap { diff --git a/packages/notice-bar/index.vue b/packages/notice-bar/index.vue index d849ac7f6..1f172f790 100644 --- a/packages/notice-bar/index.vue +++ b/packages/notice-bar/index.vue @@ -5,12 +5,11 @@ :style="barStyle" @click="$emit('click')" > -
- -
+ :name="leftIcon" + />
-
-
+
+ +
足协杯战线连续第2年上演广州德比战,上赛季半决赛上恒大以两回合5-3的总比分淘汰富力。
@@ -25,7 +26,7 @@ exports[`renders demo correctly 1`] = `
足协杯战线连续第2年上演广州德比战,上赛季半决赛上恒大以两回合5-3的总比分淘汰富力。
-
+
diff --git a/packages/notice-bar/zh-CN.md b/packages/notice-bar/zh-CN.md index e13481743..af89221d7 100644 --- a/packages/notice-bar/zh-CN.md +++ b/packages/notice-bar/zh-CN.md @@ -14,7 +14,7 @@ Vue.use(NoticeBar); ```html ``` @@ -50,7 +50,7 @@ Vue.use(NoticeBar); | delay | 动画延迟时间 (s) | `Number` | `1` | - | | speed | 滚动速率 (px/s) | `Number` | `50` | - | | scrollable | 是否在长度溢出时滚动播放 | `Boolean` | `true` | - | -| left-icon | 左侧图标图片 URL | `String` | - | - | +| left-icon | 左侧图标名称或图片链接,可选值见 Icon 组件 | `String` | - | - | | color | 文本颜色 | `String` | `#f60` | - | | background | 滚动条背景 | `String` | `#fff7cc` | - |