From e9c8c4ed48e57bab93a191880a0fdec1c61e7416 Mon Sep 17 00:00:00 2001 From: xzs02 Date: Tue, 8 Jan 2019 17:23:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3swiper=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/view/components/swiper/index.vue | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/core/view/components/swiper/index.vue b/src/core/view/components/swiper/index.vue index 7d0711351..50a37af4c 100644 --- a/src/core/view/components/swiper/index.vue +++ b/src/core/view/components/swiper/index.vue @@ -558,25 +558,26 @@ export default { }, render (createElement) { var slidesDots = [] - var index = 0 var swiperItems = [] if (this.$slots.default) { this.$slots.default.forEach(vnode => { if (vnode.componentOptions && vnode.componentOptions.tag === 'v-uni-swiper-item') { swiperItems.push(vnode) - slidesDots.push(createElement('div', { - class: { - 'uni-swiper-dot': true, - 'uni-swiper-dot-active': (index < this.currentSync + this.displayMultipleItemsNumber && index >= this.currentSync) || (index < this.currentSync + this.displayMultipleItemsNumber - this.items.length) - }, - style: { - 'background': index === this.currentSync ? this.indicatorActiveColor : this.indicatorColor - } - })) - index++ } }) } + for (let index = 0, length = swiperItems.length; index < length; index++) { + let currentSync = this.currentSync + slidesDots.push(createElement('div', { + class: { + 'uni-swiper-dot': true, + 'uni-swiper-dot-active': (index < currentSync + this.displayMultipleItemsNumber && index >= currentSync) || (index < currentSync + this.displayMultipleItemsNumber - length) + }, + style: { + 'background': index === currentSync ? this.indicatorActiveColor : this.indicatorColor + } + })) + } this.items = swiperItems var slidesWrapperChild = [createElement('div', { ref: 'slides', -- GitLab