TypeError: Cannot read property ‘$$‘ of undefined

it2023-03-05  83

解决报错:

TypeError: Cannot read property ‘$$’ of undefined at HTMLElement._attached.u._touchstartHandlerForDevtools

我们使用微信小程序开发者工具的时候,出现以上警告,是因为使用swiper组件时候,swiper的current属性没有重置 将其重置为0即可,也就是在data里面写:

data: { current: 0, ----------------------->就是这个!! banner: [], indicatorDots: true, // 显示小点点 vertical: false, // 是否纵向 autoplay: false, // 自动切换 interval: 2000, // 自动切换时间 duration: 500 // 滑动动画时长 },

加上current: 0, 就不会报错了!

最新回复(0)