|
|
<template>
|
|
|
<div class="image-swipe">
|
|
|
<div class="image-swipe" v-if="allLoaded">
|
|
|
<div class="swipe-wrap" @click.prevent="showcase()">
|
|
|
<swiper :options="swiperOption" ref="swiper">
|
|
|
<swiper-slide v-for="item in goodsList" :key="item.title">
|
...
|
...
|
@@ -20,6 +20,7 @@ |
|
|
<script>
|
|
|
require('swiper/dist/css/swiper.css');
|
|
|
import yoho from 'yoho';
|
|
|
import util from 'common/util';
|
|
|
import vas from 'vue-awesome-swiper';
|
|
|
|
|
|
export default {
|
...
|
...
|
@@ -39,7 +40,8 @@ |
|
|
onSlideChangeEnd(swiper) {
|
|
|
vm.setActiveSlide(swiper.realIndex)
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
allLoaded: false
|
|
|
};
|
|
|
},
|
|
|
components: {
|
...
|
...
|
@@ -69,6 +71,37 @@ |
|
|
}
|
|
|
this.goodsList = temp;
|
|
|
this.slideCount = this.goodsList.length;
|
|
|
},
|
|
|
goodsList(goods) {
|
|
|
const preloadImg = (list, loaded) => {
|
|
|
loaded = loaded || [];
|
|
|
|
|
|
// 加载完成
|
|
|
if(list.length === 0) {
|
|
|
let $ssr = document.getElementById('ssr');
|
|
|
$ssr && $ssr.remove();
|
|
|
this.allLoaded = true;
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
let img = new Image();
|
|
|
img.src = util.getImgUrl(list[0].image_url, '580', '770');
|
|
|
|
|
|
if(img.complete) {
|
|
|
loaded.push(img);
|
|
|
list.shift();
|
|
|
preloadImg(list, loaded);
|
|
|
}
|
|
|
else {
|
|
|
img.onload = function() {
|
|
|
loaded.push(img);
|
|
|
list.shift();
|
|
|
preloadImg(list, loaded);
|
|
|
};
|
|
|
}
|
|
|
};
|
|
|
|
|
|
preloadImg(goods[0].images_list);
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
...
|
...
|
@@ -133,9 +166,21 @@ |
|
|
height: 770px;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.show-box.carousel {
|
|
|
border-top: none;
|
|
|
border-bottom: none;
|
|
|
}
|
|
|
.show-box.info,
|
|
|
.show-box.action {
|
|
|
border-top: none;
|
|
|
}
|
|
|
|
|
|
.show-box.action {
|
|
|
padding-bottom: 0;
|
|
|
border-bottom: none;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.image-swipe {
|
|
|
position: relative;
|
...
|
...
|
|