当工具提示出现在滑块手柄上时,在控制台中执行 Javascript 时强制重排

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/48692970/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 04:12:48  来源:igfitidea点击:

Violation Forced reflow while executig Javascript in console when tooltip appear on slider handle

javascriptreactjsantd

提问by Evgeniy

I have a web page with some elements and Ant.design sliderpresent too. Slider values is controlled by React state. When slider tooltip is turn on, slider is very slow down and in console I see a message [Violation] Forced reflow while executig Javascript took ....

我有一个包含一些元素的网页,并且也Ant.design slider存在。滑块值由 React 状态控制。当滑块工具提示打开时,滑块速度非常慢,在控制台中我看到一条消息[Violation] Forced reflow while executig Javascript took ...

enter image description here

在此处输入图片说明

When slider tooltip is turn off, slider speed becomes normal. Message is appear in console also if I'am only point a mouse on slider handle (without moving handle).

当滑块工具提示关闭时,滑块速度变为正常。如果我只将鼠标指向滑块手柄(不移动手柄),则消息也会出现在控制台中。

How can I fix bad behaviour with tooltip? Thank's in advance!

如何使用工具提示修复不良行为?提前致谢!

回答by Jesper We

Slider with tooltip is a standard feature that normally works well, so chances are you have some performance issue in your code.

带有工具提示的滑块是一项标准功能,通常运行良好,因此您的代码中可能存在一些性能问题。

See the accepted answer to Violation Long running JavaScript task took xx msfor some useful tips on how to locate problems.

有关如何定位问题的一些有用提示,请参阅Violation Long running JavaScript 任务需要 xx ms的已接受答案。

For more detailed help you need to post your code, preferably as an executable example.

要获得更详细的帮助,您需要发布代码,最好是作为可执行示例。