From 2700d545e6aed154d71a248c0606436aead31327 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=AD=E8=83=9C=E5=BC=BA?= Date: Thu, 20 Dec 2018 14:43:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3swiper=E7=BB=84?= =?UTF-8?q?=E4=BB=B6previous-margin=E5=92=8Cnext-margin=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=90=8E=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=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 | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/core/view/components/swiper/index.vue b/src/core/view/components/swiper/index.vue index 5a14aa7d9..5dcf2582a 100644 --- a/src/core/view/components/swiper/index.vue +++ b/src/core/view/components/swiper/index.vue @@ -88,7 +88,7 @@ export default { }, slidesStyle () { var style = {} - if (this.nextMargin || this.nextMargin) { + if (this.nextMargin || this.previousMargin) { style = this.vertical ? { left: 0, right: 0, @@ -101,10 +101,15 @@ export default { right: this._upx2px(this.nextMargin) } } - style.width = this.vertical ? '100%' : Math.abs(100 / this.displayMultipleItemsNumber) + '%' - style.height = !this.vertical ? '100%' : Math.abs(100 / this.displayMultipleItemsNumber) + '%' return style }, + slideFrameStyle () { + var value = Math.abs(100 / this.displayMultipleItemsNumber) + '%' + return { + width: this.vertical ? '100%' : value, + height: !this.vertical ? '100%' : value + } + }, circularEnabled () { return this.circular && this.items.length > this.displayMultipleItemsNumber } @@ -580,7 +585,8 @@ export default { }, [ createElement('div', { ref: 'slideFrame', - class: 'uni-swiper-slide-frame' + class: 'uni-swiper-slide-frame', + style: this.slideFrameStyle }, swiperItems) ])] if (this.indicatorDots) { -- GitLab