当前位置 博文首页 > 一颗小陨石的博客:vue 踩坑记录 cannot read property xxx of u

    一颗小陨石的博客:vue 踩坑记录 cannot read property xxx of u

    作者:[db:作者] 时间:2021-09-16 13:40

    在这里插入图片描述
    项目使用了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没啥事 是因为这个问题间接导致的。

    cs