mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-24 02:16:12 +08:00
fix(NoticeBar): failed to replay
This commit is contained in:
parent
5b2f13311c
commit
e8bd24265d
@ -60,11 +60,11 @@ export default createComponent({
|
|||||||
this.offset = this.wrapWidth;
|
this.offset = this.wrapWidth;
|
||||||
this.duration = 0;
|
this.duration = 0;
|
||||||
|
|
||||||
doubleRaf(() => {
|
setTimeout(() => {
|
||||||
this.offset = -this.contentWidth;
|
this.offset = -this.contentWidth;
|
||||||
this.duration = (this.contentWidth + this.wrapWidth) / this.speed;
|
this.duration = (this.contentWidth + this.wrapWidth) / this.speed;
|
||||||
this.$emit('replay');
|
this.$emit('replay');
|
||||||
});
|
}, 100);
|
||||||
},
|
},
|
||||||
|
|
||||||
reset() {
|
reset() {
|
||||||
|
@ -45,7 +45,7 @@ test('replay event', async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
wrapper.find('.van-notice-bar__content').trigger('transitionend');
|
wrapper.find('.van-notice-bar__content').trigger('transitionend');
|
||||||
await later(50);
|
await later(150);
|
||||||
expect(wrapper.emitted('replay')).toBeTruthy();
|
expect(wrapper.emitted('replay')).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user