Skip to content
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

tabs 切换时卡顿 #30736

Closed
1 task done
chanelnumberseven opened this issue May 27, 2021 · 17 comments
Closed
1 task done

tabs 切换时卡顿 #30736

chanelnumberseven opened this issue May 27, 2021 · 17 comments
Labels

Comments

@chanelnumberseven
Copy link

chanelnumberseven commented May 27, 2021

  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

ant-tabs-ink-bar 的动画好像是改变left值做的,用css3动画属性(transform)是不是性能会更好一点?

What does the proposed API look like?

使用css3动画属性(transform:translate)来改变ant-tabs-ink-bar 的移动,解决动画卡顿问题

@afc163
Copy link
Member

afc163 commented May 27, 2021

性能差异会有多大?记得之前用的是 transform,也有很多渲染问题。

@afc163 afc163 added the 🤔 Need Reproduce We cannot reproduce your problem label May 28, 2021
@github-actions
Copy link
Contributor

Hello @chanelnumberseven. Please provide a online reproduction by forking this link https://u.ant.design/codesandbox-repro or a minimal GitHub repository. Issues labeled by Need Reproduce will be closed if no activities in 3 days.

你好 @chanelnumberseven, 我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击 此处 创建一个 codesandbox 或者提供一个最小化的 GitHub 仓库。3 天内未跟进此 issue 将会被自动关闭。

@chanelnumberseven
Copy link
Author

chanelnumberseven commented May 31, 2021

性能差异会有多大?记得之前用的是 transform,也有很多渲染问题。

https://developers.google.com/web/fundamentals/design-and-ux/animations/animations-and-performance?hl=zh-cn 参考这里的解释当使用transform,opacity来做动画时,会有一个单独的线程(合成器线程)来处理动画,不会占用主线程。给人感觉,性能应该优于非动画属性;

我刚在自己的项目里 尝试了一下transform,确实解决了卡顿的问题,是否可以给用户一个选择 启动css3动画?

@afc163
Copy link
Member

afc163 commented May 31, 2021

我刚在自己的项目里 尝试了一下transform,确实解决了卡顿的问题

来个对比重现看看?

@chanelnumberseven
Copy link
Author

我刚在自己的项目里 尝试了一下transform,确实解决了卡顿的问题

来个对比重现看看?

https://codesandbox.io/s/recursing-breeze-zzh87?file=/index.js:735-1118
数据量过大的话,,两种方案都会卡,但3000 5000 的时候,用transform所做的动画比非动画属性做的动画更顺畅

@github-actions github-actions bot closed this as completed Jun 7, 2021
@afc163 afc163 reopened this Jun 7, 2021
@thomas-void0
Copy link

我最近在项目中使用多个ant-pro的表格嵌套。使用tabs的来进行切换。确实tab卡顿非常的明显。

@fanguangjian
Copy link

just mark

@thomas-void0
Copy link

我使用了以下的方式可以避免tabs切换卡顿的问题。
image
这样的缺点就是,只能使用一些tabs的布局和切换效果。更多的配置项就无法使用了,无法保活隐藏页面。组件会被卸载和重新进入渲染流程。

不过至少界面上不会卡顿了,渲染就交给react吧

@afc163 afc163 reopened this Jun 14, 2021
@afc163 afc163 removed the 🤔 Need Reproduce We cannot reproduce your problem label Jun 14, 2021
@afc163
Copy link
Member

afc163 commented Jun 14, 2021

https://codesandbox.io/s/recursing-breeze-zzh87?file=/index.js:735-1118

这个例子在我机器上没感觉出明显差异。

@yoyo837
Copy link
Contributor

yoyo837 commented Jun 15, 2021

https://codesandbox.io/s/recursing-breeze-zzh87?file=/index.js:735-1118

这个例子在我机器上没感觉出明显差异。

@chanelnumberseven
Copy link
Author

https://codesandbox.io/s/recursing-breeze-zzh87?file=/index.js:735-1118

这个例子在我机器上没感觉出明显差异。

https://codesandbox.io/s/recursing-breeze-zzh87?file=/index.js 又改了下,,,感觉都卡,,,非css3动画属性 的执行明显延迟于css3动画属性,我的机器可能老,3000,5000条数据的时候就能感觉出来,, 我同事的机器高配的 10000条数据的时候,才能明显感觉出这种差距,但数据过多都会卡,感觉就算用css3动画属性也不是解决办法

@thomas-void0
Copy link

https://codesandbox.io/s/recursing-breeze-zzh87?file=/index.js:735-1118

这个例子在我机器上没感觉出明显差异。

https://codesandbox.io/s/recursing-breeze-zzh87?file=/index.js 又改了下,,,感觉都卡,,,非css3动画属性 的执行明显延迟于css3动画属性,我的机器可能老,3000,5000条数据的时候就能感觉出来,, 我同事的机器高配的 10000条数据的时候,才能明显感觉出这种差距,但数据过多都会卡,感觉就算用css3动画属性也不是解决办法

我的两个表格数据量不太大,只是请求的接口速度比较慢。loading的时间很长,在loading的过程中卡片切换的样式不会改变。要等我的全部数据渲染出来以后卡顿一会才能把样式切过来。 如果数据量比较小的话,是没有这个问题的。

@yyz945947732
Copy link
Contributor

mark

@JunlinZhu-Tommy
Copy link

mark

1 similar comment
@hesetiema
Copy link

mark

@chanTanya
Copy link

我使用了以下的方式可以避免tabs切换卡顿的问题。 image 这样的缺点就是,只能使用一些tabs的布局和切换效果。更多的配置项就无法使用了,无法保活隐藏页面。组件会被卸载和重新进入渲染流程。

不过至少界面上不会卡顿了,渲染就交给react吧
那你直接使用destroyInactiveTabPane属性就可以了:
image

@zombieJ
Copy link
Member

zombieJ commented Aug 14, 2023

Close since Tabs animation is changed.

@zombieJ zombieJ closed this as completed Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants