|
|
@@ -2,7 +2,23 @@
|
|
|
<div class="detail">
|
|
|
<swiper pagination class="mySwiper" v-if="banners.length > 0">
|
|
|
<swiper-slide v-for="(item, index) in banners" :key="index">
|
|
|
- <img :src="item" />
|
|
|
+ <video
|
|
|
+ class="swiper-video"
|
|
|
+ v-if="isVideo(item)"
|
|
|
+ :src="item.url"
|
|
|
+ :poster="getImg(changeImgs([item]))"
|
|
|
+ controls="controls"
|
|
|
+ >
|
|
|
+ 您的浏览器不支持 video 标签。
|
|
|
+ </video>
|
|
|
+ <van-image
|
|
|
+ v-else
|
|
|
+ @click="preview(index, changeImgs(banners))"
|
|
|
+ :src="item.url"
|
|
|
+ width="100vw"
|
|
|
+ height="100vw"
|
|
|
+ fit="scale-down"
|
|
|
+ />
|
|
|
</swiper-slide>
|
|
|
</swiper>
|
|
|
|
|
|
@@ -125,7 +141,9 @@ import 'swiper/swiper-bundle.min.css';
|
|
|
import SwiperCore, { Pagination } from 'swiper';
|
|
|
import Post from '../../components/Post.vue';
|
|
|
import asset from '../../mixins/asset';
|
|
|
+import product from '../../mixins/product';
|
|
|
import { mapState } from 'vuex';
|
|
|
+import { ImagePreview } from 'vant';
|
|
|
|
|
|
// install Swiper modules
|
|
|
SwiperCore.use([Pagination]);
|
|
|
@@ -137,7 +155,7 @@ export default {
|
|
|
Post
|
|
|
},
|
|
|
|
|
|
- mixins: [asset],
|
|
|
+ mixins: [asset, product],
|
|
|
data() {
|
|
|
return {
|
|
|
activeName: '1',
|
|
|
@@ -162,6 +180,12 @@ export default {
|
|
|
this.getProduct();
|
|
|
},
|
|
|
methods: {
|
|
|
+ preview(index = 0, list = []) {
|
|
|
+ ImagePreview({
|
|
|
+ images: [...list],
|
|
|
+ startPosition: index
|
|
|
+ });
|
|
|
+ },
|
|
|
getProduct() {
|
|
|
this.$toast.loading({
|
|
|
message: '加载中...',
|