vue 踩坑记录 cannot read property xxx of undefined

vue 踩坑记录 cannot read property xxx of undefined_第1张图片
项目使用了swiper轮播图,本来好好的,但是渲染完数据后 r e f s . s w i p e r N a m e . refs.swiperName. refs.swiperName.swiper 跟着失效了,渲染的数据地方也报 undefined ,虽然数据可以渲染出来。

原因:
复杂数据接收时需要指定内部结构,因为Vue只能读取其原始的数据结构,后面再加进去的会出问题。
如:

 goods:[]
 //要指定内部结构:
 goods:[
	detail:{
     },
	shopList:[]
]

swiper没啥事 是因为这个问题间接导致的。

你可能感兴趣的:(异常处理,vue,bug)