Comments (10)
在模板中不判断非空直接使用默认作用域插槽参数row的字段,会报尝试获取undefined上的属性的错误。
http://localhost:8080/#/HeaderDemo2?code=HeaderDemo2&codeTitle=head
demo没复现出来
from el-table-virtual-scroll.
在模板中不判断非空直接使用默认作用域插槽参数row的字段,会报尝试获取undefined上的属性的错误。
http://localhost:8080/#/HeaderDemo2?code=HeaderDemo2&codeTitle=head demo没复现出来
我又试了下,换回ElTableColumn不报错,只有用VirtualColumn报错。
具体原因我还没找到,找到后我再回复。
from el-table-virtual-scroll.
猜测是这样
https://github.com/xiaocheng555/el-table-virtual-scroll/blob/master/src/el-table-virtual-column.vue#L288
created钩子里 $scopedSlots还没初始化完 应该没有default插槽 isNested值恒常为true
导致上面https://github.com/xiaocheng555/el-table-virtual-scroll/blob/master/src/el-table-virtual-column.vue#L24
默认插槽渲染 而下面作用域插槽没渲染 此时获取作用域插槽参数为空 报错
如果判断非空了 等$scopedSlots有值了 就又能获取到作用域插槽参数了 所以能够变回显示正常
demo不复现的原因不太清楚 希望能确认下isNested的值是否正确的问题
from el-table-virtual-scroll.
https://github.com/xiaocheng555/el-table-virtual-scroll/blob/master/src/el-table-virtual-column.vue#L241
另外这一行代码 取反操作符的位置是不是不太对?
from el-table-virtual-scroll.
Element里有一种判断isNested的写法 是否能作为参考?
https://github.com/ElemeFE/element/blob/dev/packages/form/src/form-item.vue#L140
from el-table-virtual-scroll.
Element里有一种判断isNested的写法 是否能作为参考? https://github.com/ElemeFE/element/blob/dev/packages/form/src/form-item.vue#L140
ok
from el-table-virtual-scroll.
猜测是这样 https://github.com/xiaocheng555/el-table-virtual-scroll/blob/master/src/el-table-virtual-column.vue#L288 created钩子里 $scopedSlots还没初始化完 应该没有default插槽 isNested值恒常为true 导致上面https://github.com/xiaocheng555/el-table-virtual-scroll/blob/master/src/el-table-virtual-column.vue#L24 默认插槽渲染 而下面作用域插槽没渲染 此时获取作用域插槽参数为空 报错 如果判断非空了 等$scopedSlots有值了 就又能获取到作用域插槽参数了 所以能够变回显示正常
demo不复现的原因不太清楚 希望能确认下isNested的值是否正确的问题
你有必现的demo吗
from el-table-virtual-scroll.
我这边仅这样就可以复现了。
<VirtualScroll :data="[]">
<el-table>
<VirtualColumn label="test">
<template #default="{ row }">
<!-- 非空判断后就能正常显示 -->
<!-- {{ row ? row.test : 'no' }} -->
{{ row.test }}
</template>
</VirtualColumn>
</el-table>
</VirtualScroll>
from el-table-virtual-scroll.
我这边仅这样就可以复现了。
<VirtualScroll :data="[]"> <el-table> <VirtualColumn label="test"> <template #default="{ row }"> <!-- 非空判断后就能正常显示 --> <!-- {{ row ? row.test : 'no' }} --> {{ row.test }} </template> </VirtualColumn> </el-table> </VirtualScroll>
我改了另一种写法,你看看会不会报undefined(我demo复现不出来),升级版本 1.0.25
from el-table-virtual-scroll.
我这边仅这样就可以复现了。
<VirtualScroll :data="[]"> <el-table> <VirtualColumn label="test"> <template #default="{ row }"> <!-- 非空判断后就能正常显示 --> <!-- {{ row ? row.test : 'no' }} --> {{ row.test }} </template> </VirtualColumn> </el-table> </VirtualScroll>
升级后我这边不报错可以正常使用了,感谢!
from el-table-virtual-scroll.
Related Issues (20)
- 表格列数过多仍然会卡顿,这个会考虑解决吗? HOT 4
- 使用toggleRowSelection选中多行会卡死,有什么办法高效选中多行么 HOT 4
- 新增 Backtop 回到顶部 功能 HOT 1
- 是否考虑将element-table的select事件集成进来 HOT 3
- 是否考虑将element-table的select事件集成进来
- scrollTo事件不精确的问题 HOT 3
- 希望支持横向滚动条sticky HOT 4
- 关于在resize后vfixed类名错误问题 HOT 1
- 虚拟表格如果动态添加数据的时候就会出现空白,主要是产生的偏移值不对 HOT 2
- el-table-column 添加 show-overflow-tooltip 之后,在当前show-overflow-tooltip列滚动时,页面会抖动 HOT 1
- this.elTable.syncPosition is not a function HOT 3
- 大神考虑支持下vue3不? HOT 1
- 复制案例换了数据 虚拟滚动就不生效了
- 增加selection列,使用filter实现搜索功能,搜索前选中的行,搜索后仍被选中,这个是bug还是做了处理 HOT 29
- 虚拟列表是否有类似el-table实例中的selection属性 HOT 7
- vue3 为啥没有更新了? HOT 1
- 使用模拟树结构懒加载时,如何让prop不显示 HOT 5
- 使用 <virtual-column> vfixed, 表尾合计行对应的列没有固定 HOT 3
- `VirtualColumn` 使用 vfixed 若 left 不在最前,right 不在最后,将无效 HOT 2
- 滚动后触发blur事件 取到的index不对 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from el-table-virtual-scroll.