Cannot read property 'XXX' of undefined"

实例:

报错:Cannot read property 'itemGroupList' of undefined"

解决方法:在itemGroupList上一层判断一下父级元素

<div v-if="table2.itemCat">
   <div v-for="(itemgrounp,indexgrounp) in table2.itemCat.itemGroupList" :key="indexgrounp">
       <div>
           <div style="display:flex;juistify-content:flex-start;margin:10px">
           <span>分组名:</span>
           <el-input v-model="itemgrounp.group_name" placeholder="请输入分组名称" class="grounp_name"></el-input>
           <el-button @click="deleteBygroundid(indexgrounp)" type="danger" icon="el-icon-delete" style="height:40px;margin-left:15px" circle></el-button>
       </div>
   </div>
</div>
原文地址:https://www.cnblogs.com/meiyanstar/p/13157784.html