报 [Vue warn]: Error in render: "TypeError: Cannot read property 'stInfoCode' of null" 的错误

当我们运行 Vue 项目的时候,报 [Vue warn]: Error in render: "TypeError: Cannot read property 'stInfoCode' of null" 的错误 

报 [Vue warn]: Error in render: "TypeError: Cannot read property 'stInfoCode' of null" 的错误

检查 template 模板中后发现所有的用到的变量基本都定义了, 图中的问题是说明用到的 stInfoCode 变量属性为 null ,仔细检查一下代码中用到地方

报 [Vue warn]: Error in render: "TypeError: Cannot read property 'stInfoCode' of null" 的错误

发现 tabInfoArr  的值为 null,因此变量中没有 stInfoCode 的属性值,遍历的生成的 tia 也找不到该值,因此会报错,因此在使用该遍历的时候应该利用 v-if 先判断一下,如果不存在就不加载。如下加了判断的时候,报错就没有了。

报 [Vue warn]: Error in render: "TypeError: Cannot read property 'stInfoCode' of null" 的错误