Skip to content

在较新版本的 Vue 下使用,拖动滚动条会出现闪动 #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
aisin opened this issue Oct 23, 2018 · 3 comments
Closed

在较新版本的 Vue 下使用,拖动滚动条会出现闪动 #72

aisin opened this issue Oct 23, 2018 · 3 comments

Comments

@aisin
Copy link
Contributor

aisin commented Oct 23, 2018

当组件在 Vue 高于 v2.5.0 (含 v2.5.0) 版本使用时,拖动滚动条时内容会出现闪动,拖动稍快时甚至会出现白屏,但使用 v2.4.4 及以下版本则无此问题。

可以参见 DEMO:https://jsfiddle.net/aisin/h6u2km1a/34/

@sally2015
Copy link

这是什么原因呢?可以enhance哪里的代码? @tangbc

@lkho
Copy link

lkho commented Dec 15, 2018

It's due to the change of nextTick implementation in Vue 2.5

https://jsfiddle.net/llkho/j21tmq85/6/

The newer version is using MessageChannel while old one is using Promise.then.
I think there's not much to 'enhance' at the plugin's side.

Edit:

In latest Vue version (2.5.21) at the current time, there are separated macroTimerFunc and microTimerFunc inside nextTick implementation, and the docs mentioned calling nextTick inside v-on handlers are forced to use macroTimerFunc (see https://github.com/vuejs/vue/releases/tag/v2.5.0 , 'Internals' section at the bottom).

If the issue really matters, you can bypass Vue's nextTick by wrapping the this.$forceUpdate call inside your own microTimerFunc, e.g.

Promise.resolve().then(() => this.$forceUpdate())

delta.end = zone.end
delta.start = zone.start
this.$forceUpdate()
},

and it will escape from the v-on handler's default macroTimerFunc behaviour.

@tangbc
Copy link
Owner

tangbc commented Dec 29, 2018

It's fixed in latest version.

@tangbc tangbc closed this as completed Dec 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants