Commit 48a42e0b by zhanghaozhe

temp

parent 4ec43902
import React, { Component } from 'react'; import React, { Component } from 'react';
import Swiper from 'swiper' import Swiper from 'swiper'
import './index.scss'
import 'swiper/dist/css/swiper.min.css' import 'swiper/dist/css/swiper.min.css'
class TopSwiper extends Component { class Index extends Component {
container = null container = null
swiper swiper
componentDidMount() { componentDidMount() {
const {bannerList} = this.props
const _this = this
this.swiper = new Swiper('.swiper-container', { this.swiper = new Swiper('.swiper-container', {
direction: 'horizontal', direction: 'horizontal',
loop: true, loop: true,
on:{ spaceBetween: 12,
progress(e){ centeredSlides: true,
console.log(e); slidesPerView: 'auto',
loopedSlides: 2,
on: {
sliderMove() {
} }
} }
}) })
} }
...@@ -21,7 +29,7 @@ class TopSwiper extends Component { ...@@ -21,7 +29,7 @@ class TopSwiper extends Component {
render() { render() {
const {bannerList} = this.props const {bannerList} = this.props
return ( return (
<div className={'swiper-container index-swiper'} ref={el => this.container = el}> <div className={'swiper-container'} ref={el => this.container = el}>
<ul className="swiper-wrapper"> <ul className="swiper-wrapper">
{bannerList.length && bannerList.map((item, index) => { {bannerList.length && bannerList.map((item, index) => {
return ( return (
...@@ -36,4 +44,4 @@ class TopSwiper extends Component { ...@@ -36,4 +44,4 @@ class TopSwiper extends Component {
} }
} }
export default TopSwiper; export default Index;
\ No newline at end of file \ No newline at end of file
.swiper {
&-container {
padding: 0 20px !important;
}
&-slide {
transform: scale3d(1,0.9,1);
img {
width: 100% !important;
height: 100% !important;
}
&-active {
width: 335px !important;
height: 168px !important;
transform: scale3d(1, 1, 1);
img {
width: 100% !important;
height: 100% !important;
}
}
}
img {
width: 100%;
height: 100%;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment