created() { axios .get( "http://wkt.myhope365.com//weChat/applet/course/banner/list?number" ).then((res) => { this.swiperList = res.data.data; // 等界面下一次更新结束之后执行回调 this.$nextTick(() => { var mySwiper = new Swiper('.swiper-container', { direction: 'horizontal', // 垂直切换选项 loop: true, // 循环模式选项 autoplay: true, // 如果需要分页器 pagination: { el: '.swiper-pagination', }, // 如果需要前进后退按钮 navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, }) }) }); }