renderHeader的表头数据变化时,表头不会重新渲染问题的解决方法 #4089
qq2267222680
started this conversation in
Show and tell
Replies: 1 comment
-
网络问题导致发重复成两条了,见谅 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
场景:我想要些一个渲染在表头中的下拉菜单,用于控制表中各列的显示。(下拉菜单中采用文字+switch按钮)
方法1:将renderHeader更换为slot="header"的方式,并添加:key="Math.random()"。!!!但是该方法重新渲染会将下拉菜单收回,而我想要保持显示。!!!
加key的方法来自CSDN老哥“新津之虎--曹达华”的文章:https://blog.csdn.net/Admin_yws/article/details/111572887
方法2:将slot="header"改为#header。
该方法来自CSDN老哥“找不到的二蛋”的文章:https://blog.csdn.net/ITk_Programmer/article/details/122216651
解法3:调用table的doLayout()函数
该方法还能解决表格列动态显示(新增或移除)时的抖动问题,因此推荐第三种方法。
Beta Was this translation helpful? Give feedback.
All reactions