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
[Build] [table, table-column] 使用vite 打包前 #9029
Labels
Comments
由于template中无法直接使用可选链,你可以构建一个getAddress的函数去返回address,例如 // script
function getAddress(row){
return row?.other?.address || ''
}
//template
{{ getAddress(row) }} |
感谢你的回复和解答,我会尝试使用这种方法 |
这个应该是 element plus 的bug , scope.row 在初始化的时候, 它的值可能是一个 空对象 {} , 在线上可能就会导致这个问题
|
template 中是可以用的 |
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug Type:
Build
Environment
3.2.37
2.2.9
Chrome/103.0.0.0
Vite
Reproduction
Related Component
el-table
el-table-column
Reproduction Link
Element Plus Playground
Steps to reproduce
大概是这么个样子
展示表格数据
第三项没有字段
表格不展示
const list = ref([
{name:'张三',age:12,height:143,weight:80,other:{
address:'北京西城'
}},
{name:'李四',age:22,height:173,weight:140,other:{
address:'上海浦东'
}},
{name:'王二',age:23,height:163,weight:120,other:{}},
])
What is Expected?
正常显示 没有值就为空
What is actually happening?
在开发中期望行为,在使用vite打包后 偶尔 会出现报错
cannot read properties of null (reading 'insertBefore') 或者 单个字母 t is not a function等报错 这种我网上查是 绑定的数据没有值 el-talbe中 虚拟DOM 相关的提示的报错
Additional comments
目前我大概了解了问题产生的原因 解决办法是在渲染DOM前先判断是否有值来避免产生这种问题。
我有几点需求:
1.这个问题是开发者产生的,能否有方法避免它,在开发环境下
2.我不清楚是否是有配置来检查错误,如果有,请给我介绍,感谢。
3.如果已经有解决的办法,也请告诉我,我并不是很精通vue和element-plus。
The text was updated successfully, but these errors were encountered: