From f23528f3bdd169ea37a38cadf80b63182d36cfd6 Mon Sep 17 00:00:00 2001 From: Emine Zhai Date: Mon, 7 May 2018 11:09:16 +0800 Subject: [PATCH] Fix swiper component auto height problem. --- src/components/swiper/swiper.vue | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/swiper/swiper.vue b/src/components/swiper/swiper.vue index e20cc0a7c..2e6fe4823 100755 --- a/src/components/swiper/swiper.vue +++ b/src/components/swiper/swiper.vue @@ -114,13 +114,13 @@ export default { }, getHeight () { const hasHeight = parseInt(this.height, 10) - if (hasHeight) return this.height - if (!hasHeight) { - if (this.aspectRatio) { - return this.$el.offsetWidth * this.aspectRatio + 'px' - } - return '180px' + if (hasHeight) { + return this.height + } + if (this.aspectRatio) { + return this.$el.offsetWidth * this.aspectRatio + 'px' } + return 'auto' } }, props: { @@ -163,7 +163,7 @@ export default { }, height: { type: String, - default: 'auto' + default: '180px' }, aspectRatio: Number, minMovingDistance: {