Vue components Cannot read property '__ob__' of undefined
2017-11-28 11:23
1176 查看
最近使用vue重构项目遇到一个问题,困扰了2天
点击搜索后页面显示搜索结果,此时调用组件列表
列表渲染之后,显示当前列表,再点击清除按钮还原搜索前状态,即图1
此时报错如下:Cannot read property ‘ob’ of undefined
因为列表组件由另一同事缩写,个人也粗心并没有多看,从头触发排除
试着用div方式去循环,发现并没有报错,锁定问题出现在Newslists组件中,
最终排查原因并不是数据出错,只是一个简单的data中没有写return!
一个简单的return 困扰了很长时间,也找过网上有人所说的主页调用子组件,需要把 list[] 传入组件中,在组件中循环,也试过此方式发现并没有用。
最后总结:开发过程需严谨,开发时间浪费在return上确实有点难受呀!!!
点击搜索后页面显示搜索结果,此时调用组件列表
列表渲染之后,显示当前列表,再点击清除按钮还原搜索前状态,即图1
此时报错如下:Cannot read property ‘ob’ of undefined
因为列表组件由另一同事缩写,个人也粗心并没有多看,从头触发排除
试着用div方式去循环,发现并没有报错,锁定问题出现在Newslists组件中,
最终排查原因并不是数据出错,只是一个简单的data中没有写return!
一个简单的return 困扰了很长时间,也找过网上有人所说的主页调用子组件,需要把 list[] 传入组件中,在组件中循环,也试过此方式发现并没有用。
最后总结:开发过程需严谨,开发时间浪费在return上确实有点难受呀!!!
相关文章推荐
- Vue2.0 之 vue Cannot read property '__ob__' of undefined 异常(back报错)
- Vue-router cannot read property _c of undefined
- vue Uncaught TypeError: Cannot read property 'gc' of undefined
- vue项目中Error in render function: "TypeError: Cannot read property 'matched' of undefined"
- Cannot read property 'component' of undefined 即vue-router 0.x转化为2.x
- uploadify的JS组件报错:Uncaught TypeError: Cannot read property 'queueData' of undefined
- Cannot read property 'nodeName' of undefined
- 错误码:Uncaught TypeError: Cannot read property 'field' of undefined
- fs.renameSync cannot read property 'path' of undefined
- ionic3 ionic cordova build ios报错 Cannot read property 'mergeAndUpdateDir' of undefined
- Uncaught TypeError: Cannot read property 'val' of undefined
- background.js Uncaught TypeError: Cannot read property 'xxx' of undefined
- NPM:Cannot read property 'pause' of undefined
- Uncaught TypeError: Cannot read property 'msie' of undefined
- Uncaught TypeError: Cannot read property 'toLowerCase' of undefined
- cannot read property 'shape' of undefined
- jquery.dataTables.min.js:62 Uncaught TypeError: Cannot read property 'style' of undefined原因
- 百度地图js Uncaught TypeError: Cannot read property 'gc' of undefined
- 关于js页面:cannot read property 'call' of undefined
- Uncaught TypeError: Cannot read property 'length' of undefined