npm上好用的轮播图插件-快速构建轮播图-react-awesome-swiper
发布日期:2021-06-30 11:52:12 浏览次数:2 分类:技术文章

本文共 1168 字,大约阅读时间需要 3 分钟。

安装插件

npm install react-awesome-swiper

使用 

import React from 'react';import AwesomeSwiper from 'react-awesome-swiper';//this config is same as idangrous swiperconst config = {  loop : true,  autoplay: {    delay: 3000,    stopOnLastSlide: false,    disableOnInteraction: true,  },  // Disable preloading of all images  preloadImages: false,  // Enable lazy loading  lazy: true,  speed: 500,  navigation: {    nextEl: '.swiper-button-next',    prevEl: '.swiper-button-prev',  },  pagination: {    el: '.swiper-pagination',    bulletElement : 'li',    hideOnClick :true,    clickable :true,  },  on: {    slideChange: function () {      console.log(this.activeIndex);    },  },};class Example extends React.Component {  swiperRef = null  goNext = () => {//use `this.swiperRef.swiper` to get the instance of Swiper    this.swiperRef.swiper.slideNext();  }  render() {     return (      
(this.swiperRef = ref)} config={config} className="your-classname">
slider1
slider2
slider3
) }} export default Example;

 

转载地址:https://jackiehao.blog.csdn.net/article/details/107084141 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:axios中批量请求方法解决同时请求多个接口-多并发
下一篇:node-vue项目打包上线-注意事项

发表评论

最新留言

路过,博主的博客真漂亮。。
[***.116.15.85]2024年04月29日 19时11分58秒