一、安装swiper npm install swiper
二、引入js文件 import Swiper from "swiper";
三、在main.js引入css文件 import 'swiper/dist/css/swiper.min.css';
四、在需要播放的组件中的mounted
var swiper = new Swiper('.swiper-container', {
pagination: '.swiper-pagination',
nextButton: '.swiper-button-next',
prevButton: '.swiper-button-prev',
paginationClickable: true,
spaceBetween: 30,
centeredSlides: true,
autoplay: 2500,
autoplayDisableOnInteraction: false
});