[Vue]“TypeError: Cannot read property ‘id‘ of undefined“的解决方法_cannot read properties of undefined (reading 'id')-CSDN博客

网站介绍:文章浏览阅读7.8k次。原因一:异步请求数据还没到,vue在拿到数据之前就已经渲染完了页面解决方案数据为数组:hotspotList[i]&&hotspotList[i].itemid例如 <div style="display: flex;justify-content: space-between"> <p class="item-title">{{hotspotList[i]&&hotspotList[i].hotspotTitl_cannot read properties of undefined (reading 'id')