zhouheng 发表于 2019-1-25 14:36:29

求救

本帖最后由 zhouheng 于 2019-1-25 14:44 编辑

var mySwiper = new Swiper('.swiper-container', {
                        loop: true,//开启环路之后就会出现复制第一个跟最后一个的情况但是我每个轮番里面有id复制第一个跟最后那个会出现id相同,怎么开启轮番不出现复制第一个跟最后一个呢
                        observer: true,
                        observeParents: true,
                        on: {
                            slideChangeTransitionStart: function() {
                              console.log(this.realIndex)
                              var spans = dbox.getElementsByClassName("swiper-slides");
                              for (var i in spans) {
                                    var nodo = spans;
                                    i == this.realIndex ? nodo.className = "swiper-slides focus" : nodo.className = "swiper-slides unfocus";
                              }
                              onselect(this.realIndex, "{}");
                              if (size > 3) {
                                    updateNavPosition(this.realIndex);
                              }
                            }
                        },

zhouheng 发表于 2019-1-25 14:41:04

   
<div class="swiper-container">
                <div class="swiper-wrapper">
                  <div class="item swiper-slide" v-for="(item,index) in projectlist">
                        <div class="con" @click='toDetail(index)'>
                            <div id="meetings-wap" class="tops-right" :class="{invisable:information.isMeeting!=1}" @click="toMeeting(index);">
                              <div class="meetings"></div>
                            </div>
                            <div class="box-v box-center progress" :style="fnHeights(item_h)">
                              <canvas v-bind:id="'myCanvas'+index" class="myCanvas" width=250 height=250 :style="fnWh(item_h)"></canvas>
                              <div class="box-v box-center perw" :style="fnCancasHeights(item_h)">
                                    <div v-bind:id="'per'+index" class="per" v-if="information.elapse_days!=null">0</div>
                                    <div class="per" v-else>0</div>
                                    <div class="txt">Days</div>
                              </div>
                            </div>
                            <div class="mgrname">
                              {{LimitNumber(item.outline)}}{{index}}
                            </div>
                        </div>
                  </div>
                </div>
                <!-- <div class="swiper-pagination"></div> swiper-container-->
            </div>



methods: {
                initSwiper: function(size, num) {
                  var elooP;
                  if (size > 3) {
                        elooP = true;
                  } else {
                        elooP = false;
                  }
                  var mySwiper = new Swiper('.swiper-container', {
                        loop: elooP,
                        observer: true,
                        observeParents: true,
                        on: {
                            slideChangeTransitionStart: function() {
                              console.log(this.realIndex)
                              var spans = dbox.getElementsByClassName("swiper-slides");
                              for (var i in spans) {
                                    var nodo = spans;
                                    i == this.realIndex ? nodo.className = "swiper-slides focus" : nodo.className = "swiper-slides unfocus";
                              }
                              onselect(this.realIndex, "{}");
                              if (size > 3) {
                                    updateNavPosition(this.realIndex);
                              }
                            }
                        },
                  });
                },

求帮忙怎么起开在开启loop又不致使出现复制第一个跟最后一个的问题。或者关闭环路,怎么做到最后一个回滚到第一个
页: [1]
查看完整版本: 求救