1 createSwiper1() {
2 var option = {
3 // slidesPerView: 5,
4 slidesPerView: 3,
5 centeredSlides:true,
6 };
7 if (this.state.newData.length > 2) {
8 option = {
9 loop: true,
10 loopedSlides: this.state.newData.length,
11 loopAdditionalSlides: 3,
12 slidesPerView: 'auto',
13 // slidesPerView: '3',
14 centeredSlides:true,
15 effect:'coverflow',
16 paginationClickable: true,
17 preventLinksPropagation: true,
18 observer: true,//修改swiper自己或子元素时,自动初始化swiper
19 observeParents: true,//修改swiper的父元素时,自动初始化swiper
20 coverflow:{
21 rotate: 0,
22 stretch: 85,
23 depth: 52,
24 modifier: 1,
25 slideShadows: true
26 },
27
28 nextButton: '.swiper-button-next',
29 prevButton: '.swiper-button-prev',
30 onTouchEnd: (swiper) => {
31 window.slideSwitchMp3();
32 }
33 }
34 }
35 var mySwiper = new Swiper('#'+ (this.props.place +'NewSwiperId'),option);
36
37 mySwiper.on('tap',(swiper,e) => {
38 var that=this;
39 let item = this.state.newData[swiper.realIndex];
40 var buttonId=document.getElementById(this.props.place +'buttonId')
41 var buttonPrev=document.getElementById(this.props.place +'button-prev')
42 var buttonNext=document.getElementById(this.props.place +'button-next')
43 if(that.isDOMContains(buttonPrev,e.target,buttonId) ||that.isDOMContains2(buttonNext,e.target,buttonId)){
44 return false;
45 }else {
46 if (item) {
47 this.setState({newDetailShow: true, selectNewItem: item, eyeNum: 0, newDetailData: []}, () => {
48 if (item.infotype == 2) {
49 this.createPdf(item.pdfurl);
50 }
51 else {
52 this.fetchNewDetail();
53 }
54 this.props.parentCallback && this.props.parentCallback();
55 });
56 window.clickSoundEffect();
57 }
58 }
59 });
60 },