fix(NoticeBar): can't replay in iOS14 (#7516)

This commit is contained in:
neverland 2020-11-08 16:36:18 +08:00 committed by GitHub
parent d59a17c5e1
commit 2615bc54dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,5 @@
import { createNamespace, isDef } from '../utils'; import { createNamespace, isDef } from '../utils';
import { doubleRaf } from '../utils/dom/raf'; import { doubleRaf, raf } from '../utils/dom/raf';
import { BindEventMixin } from '../mixins/bind-event'; import { BindEventMixin } from '../mixins/bind-event';
import Icon from '../icon'; import Icon from '../icon';
@ -70,7 +70,8 @@ export default createComponent({
this.duration = 0; this.duration = 0;
// wait for Vue to render offset // wait for Vue to render offset
this.$nextTick(() => { // using nextTick won't work in iOS14
raf(() => {
// use double raf to ensure animation can start // use double raf to ensure animation can start
doubleRaf(() => { doubleRaf(() => {
this.offset = -this.contentWidth; this.offset = -this.contentWidth;