Authored by 陈峰

fix image scale

@@ -24,23 +24,24 @@ export default { @@ -24,23 +24,24 @@ export default {
24 }; 24 };
25 }, 25 },
26 itemSize() { 26 itemSize() {
27 - const {height: fHeight} = this.thumbSize; 27 + const {width: fWidth, height: fHeight} = this.thumbSize;
  28 + const fScale = fWidth / fHeight;
28 const scale = this.data.width / this.data.height; 29 const scale = this.data.width / this.data.height;
29 30
30 - if (scale > 1) { 31 + if (scale > fScale) {
31 return { 32 return {
32 - width: 750 / 40,  
33 - height: 750 / 40 / scale 33 + width: fWidth,
  34 + height: fWidth / scale
34 }; 35 };
35 - } else if (scale < 1) { 36 + } else if (scale < fScale) {
36 return { 37 return {
37 width: fHeight * scale, 38 width: fHeight * scale,
38 height: fHeight 39 height: fHeight
39 }; 40 };
40 } else { 41 } else {
41 return { 42 return {
42 - width: 750 / 40,  
43 - height: 750 / 40 43 + width: fWidth,
  44 + height: fHeight
44 }; 45 };
45 } 46 }
46 } 47 }
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 <ArticleItemSlideImage v-if="data.blockList.length === 1" :lazy="false" :data="data.blockList[0]" :thumb-size="firstBlockSize"></ArticleItemSlideImage> 4 <ArticleItemSlideImage v-if="data.blockList.length === 1" :lazy="false" :data="data.blockList[0]" :thumb-size="firstBlockSize"></ArticleItemSlideImage>
5 <Slide :key="`slide${data.articleId}`" v-else ref="slide" :data="data.blockList" :refresh-reset-current="false" :initial-index="slideIndex - 1" :threshold="0.2" :auto-play="false" :loop="false" :options="scrollOption" @change="onChange"> 5 <Slide :key="`slide${data.articleId}`" v-else ref="slide" :data="data.blockList" :refresh-reset-current="false" :initial-index="slideIndex - 1" :threshold="0.2" :auto-play="false" :loop="false" :options="scrollOption" @change="onChange">
6 <SlideItem class="slide-item" :style="slideItemStyle" v-for="(item, inx) in data.blockList" :key="inx"> 6 <SlideItem class="slide-item" :style="slideItemStyle" v-for="(item, inx) in data.blockList" :key="inx">
7 - <ArticleItemSlideImage v-if="!thumb || inx === 0" :lazy="lazy && inx > 0" :data="item" :thumb-size="firstBlockSize"></ArticleItemSlideImage> 7 + <ArticleItemSlideImage v-if="!thumb || inx === 0" :lazy="lazy || inx > 0" :data="item" :thumb-size="firstBlockSize"></ArticleItemSlideImage>
8 </SlideItem> 8 </SlideItem>
9 <template slot="dots" slot-scope="props"> 9 <template slot="dots" slot-scope="props">
10 <span class="slide-dot" 10 <span class="slide-dot"