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

为什么对表格进行筛选的时候会重新渲染td的内容 #34

Open
novazz opened this issue Aug 21, 2019 · 1 comment
Open

为什么对表格进行筛选的时候会重新渲染td的内容 #34

novazz opened this issue Aug 21, 2019 · 1 comment

Comments

@novazz
Copy link

novazz commented Aug 21, 2019

使用el-table的时候,我自己写了一个渲染函数来显示表格内的内容,目的是为了显示一些图片或者富文本:
<template slot-scope="cd">
<div v-html="render(cd.row, col.index)" style="display:inline"></div>
</template>
但问题出来了,在对列进行筛选操作的时候,每次展开和关闭筛选选择框,都要调用 render函数,为什么要这样做,这样既没有任何作用,而且还十分低效,有没有什么办法能避免,我看有个filtered-value的列属性好像可以用,但是没看明白是怎么用的

@novazz
Copy link
Author

novazz commented Aug 21, 2019

试了试,就算不对表格进行筛选,我的数据一共只有12条,每条有13列,按理来讲只需要调用12*13=156次渲染函数,但是我利用console统计发现它在初始化的时候就一共调用了624次,不知道是每条还是每列进行了不必要的重复渲染,请问为什么会这样?应该如何避免

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant