2.12.0
Windows_NT x64 10.0.18362 / Chrome 75.0.3770.100 64-bit
2.6.10
https://codepen.io/yft/pen/rNNNjxg
Open the url.
Possible reason:
When form is display: none
, getComputedStyle().width
returns auto
.
Why does getComputedStyle return 'auto' for pixels values right after element creation?
No error.
Error when destroy.
我也遇到了相同的问题,form组件的label-width设置为auto时。
我也遇到了相同的问题,form组件的label-width设置为auto时。
简单临时解决。有问题的部分 v-show 换成v-if
@chen950103 改成v-show改为v-if确实没有报错了,请问是为什么呢?原因是?
@DengDongXia 楼主已经说了为什么了。 我没有仔细研究,大概的问题是 被隐藏的Dom的宽度是auto,组件被添加删除处理宽度的时候将auto强制转换成了int 产生了NaN的值。最终组件没法创建和删除。解决的办法是不使用隐藏功能,使用是否渲染组件。规避这个bug。
@chen950103 明白,谢谢
This needs a fix I believe. According to Sentry we had this error thrown 1000+ times and from what I can gather thanks to the Google translation of the conversation above it's probably because our forms reside in a <transition>
which changes the display property.
Same here, I've part of the form inside a el-tab-pane component.
I keep reporting this error when switching back and forth between form pages while jumping multiple subpaths
up
label-width设为auto,可以省略不写,就可以不报错了,刚刚实践过,默认应该就是auto
label-width设为auto,可以省略不写,就可以不报错了,刚刚实践过,默认应该就是auto
不写的话默认宽度是80px,我这边的项目需要国际化,有一个inline的表单,切换语言后lablel长度不一样,路由切换后就报错,解决方案是省略不写,然后用css hack了一下
.filter >>> .el-form-item__label{
width: auto!important;
}
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
@DengDongXia 楼主已经说了为什么了。 我没有仔细研究,大概的问题是 被隐藏的Dom的宽度是auto,组件被添加删除处理宽度的时候将auto强制转换成了int 产生了NaN的值。最终组件没法创建和删除。解决的办法是不使用隐藏功能,使用是否渲染组件。规避这个bug。