diff --git a/example/pages/notice-bar/index.wxml b/example/pages/notice-bar/index.wxml
index 95c8febc..61ab75df 100644
--- a/example/pages/notice-bar/index.wxml
+++ b/example/pages/notice-bar/index.wxml
@@ -5,11 +5,15 @@
/>
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/packages/notice-bar/index.less b/packages/notice-bar/index.less
index d7b1699e..7113889a 100644
--- a/packages/notice-bar/index.less
+++ b/packages/notice-bar/index.less
@@ -6,15 +6,31 @@
line-height: 24px;
align-items: center;
- &--within-icon {
+ &--withicon {
position: relative;
padding-right: 40px;
}
+ &--wrapable {
+ height: auto;
+ padding: 8px 15px;
+
+ .van-notice-bar {
+ &__wrap {
+ height: auto;
+ }
+
+ &__content {
+ position: relative;
+ white-space: normal;
+ }
+ }
+ }
+
&__left-icon {
+ display: flex;
margin-right: 4px;
vertical-align: middle;
- display: flex;
align-items: center;
}
@@ -25,7 +41,7 @@
font-size: 16px;
}
- &__content-wrap {
+ &__wrap {
position: relative;
height: 24px;
overflow: hidden;
diff --git a/packages/notice-bar/index.ts b/packages/notice-bar/index.ts
index 7556d703..b9a53d56 100644
--- a/packages/notice-bar/index.ts
+++ b/packages/notice-bar/index.ts
@@ -23,7 +23,7 @@ VantComponent({
},
delay: {
type: Number,
- value: 0
+ value: 1
},
speed: {
type: Number,
@@ -44,12 +44,12 @@ VantComponent({
backgroundColor: {
type: String,
value: BG_COLOR
- }
+ },
+ wrapable: Boolean
},
data: {
- show: true,
- hasRightIcon: false
+ show: true
},
watch: {
@@ -59,12 +59,6 @@ VantComponent({
},
created() {
- if (this.data.mode) {
- this.set({
- hasRightIcon: true
- });
- }
-
this.resetAnimation = wx.createAnimation({
duration: 0,
timingFunction: 'linear'
@@ -79,7 +73,7 @@ VantComponent({
init() {
Promise.all([
this.getRect('.van-notice-bar__content'),
- this.getRect('.van-notice-bar__content-wrap')
+ this.getRect('.van-notice-bar__wrap')
]).then((rects: wx.BoundingClientRectCallbackResult[]) => {
const [contentRect, wrapRect] = rects;
if (
diff --git a/packages/notice-bar/index.wxml b/packages/notice-bar/index.wxml
index c763a4d4..034ce6fe 100644
--- a/packages/notice-bar/index.wxml
+++ b/packages/notice-bar/index.wxml
@@ -1,6 +1,8 @@
+
+
@@ -11,8 +13,8 @@
class="van-notice-bar__left-icon"
/>
-
-
+
+
{{ text }}