商品详情页轮播图和加入购物车属性图无法点击放大
This commit is contained in:
@ -1,9 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="slider-banner product-bg">
|
<view class="slider-banner product-bg">
|
||||||
<swiper class="swiper-wrapper" @change="handleChange" v-if="imgUrls.length > 0">
|
<swiper
|
||||||
|
class="swiper-wrapper"
|
||||||
|
@change="handleChange"
|
||||||
|
v-if="imgUrls.length > 0"
|
||||||
|
>
|
||||||
<block v-for="(item, imgUrlsIndex) in imgUrls" :key="imgUrlsIndex">
|
<block v-for="(item, imgUrlsIndex) in imgUrls" :key="imgUrlsIndex">
|
||||||
<swiper-item>
|
<swiper-item>
|
||||||
<image :src="item" class="slide-image" />
|
<image :src="item" @tap="previewImage(imgUrlsIndex)" class="slide-image" />
|
||||||
</swiper-item>
|
</swiper-item>
|
||||||
</block>
|
</block>
|
||||||
</swiper>
|
</swiper>
|
||||||
@ -27,35 +31,41 @@ export default {
|
|||||||
props: {
|
props: {
|
||||||
imgUrls: {
|
imgUrls: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => []
|
default: () => [],
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
data: function() {
|
data: function () {
|
||||||
let that = this;
|
let that = this;
|
||||||
return {
|
return {
|
||||||
currents: 1,
|
currents: 1,
|
||||||
ProductConSwiper: {
|
ProductConSwiper: {
|
||||||
autoplay: {
|
autoplay: {
|
||||||
disableOnInteraction: false,
|
disableOnInteraction: false,
|
||||||
delay: 2000
|
delay: 2000,
|
||||||
},
|
},
|
||||||
loop: true,
|
loop: true,
|
||||||
speed: 1000,
|
speed: 1000,
|
||||||
observer: true,
|
observer: true,
|
||||||
observeParents: true,
|
observeParents: true,
|
||||||
on: {
|
on: {
|
||||||
slideChangeTransitionStart: function() {
|
slideChangeTransitionStart: function () {
|
||||||
that.currents = this.realIndex + 1;
|
that.currents = this.realIndex + 1;
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted: function() {},
|
mounted: function () {},
|
||||||
methods: {
|
methods: {
|
||||||
handleChange(event) {
|
handleChange(event) {
|
||||||
this.currents = event.mp.detail.current + 1;
|
this.currents = event.mp.detail.current + 1;
|
||||||
}
|
},
|
||||||
}
|
previewImage(current) {
|
||||||
|
uni.previewImage({
|
||||||
|
current,
|
||||||
|
urls: this.imgUrls,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -3,20 +3,24 @@
|
|||||||
<view class="product-window" :class="attr.cartAttr === true ? 'on' : ''">
|
<view class="product-window" :class="attr.cartAttr === true ? 'on' : ''">
|
||||||
<view class="textpic acea-row row-between-wrapper">
|
<view class="textpic acea-row row-between-wrapper">
|
||||||
<view class="pictrue">
|
<view class="pictrue">
|
||||||
<image :src="attr.productSelect.image" class="image" />
|
<image @tap="previewImage" :src="attr.productSelect.image" class="image" />
|
||||||
</view>
|
</view>
|
||||||
<view class="text">
|
<view class="text">
|
||||||
<view class="line1">{{ attr.productSelect.store_name }}</view>
|
<view class="line1">{{ attr.productSelect.store_name }}</view>
|
||||||
<view class="money font-color-red">
|
<view class="money font-color-red">
|
||||||
¥
|
¥
|
||||||
<text class="num">{{ attr.productSelect.price}}</text>
|
<text class="num">{{ attr.productSelect.price }}</text>
|
||||||
<text class="stock">库存: {{ attr.productSelect.stock }}</text>
|
<text class="stock">库存: {{ attr.productSelect.stock }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="iconfont icon-guanbi" @click="closeAttr"></view>
|
<view class="iconfont icon-guanbi" @click="closeAttr"></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="productWinList">
|
<view class="productWinList">
|
||||||
<view class="item" v-for="(item, indexw) in attr.productAttr" :key="indexw">
|
<view
|
||||||
|
class="item"
|
||||||
|
v-for="(item, indexw) in attr.productAttr"
|
||||||
|
:key="indexw"
|
||||||
|
>
|
||||||
<view class="title">{{ item.attrName }}</view>
|
<view class="title">{{ item.attrName }}</view>
|
||||||
<view class="listn acea-row row-middle">
|
<view class="listn acea-row row-middle">
|
||||||
<view
|
<view
|
||||||
@ -25,28 +29,36 @@
|
|||||||
v-for="(itemn, indexn) in item.attrValue"
|
v-for="(itemn, indexn) in item.attrValue"
|
||||||
@click="tapAttr(indexw, indexn)"
|
@click="tapAttr(indexw, indexn)"
|
||||||
:key="indexn"
|
:key="indexn"
|
||||||
>{{ itemn.attr }}</view>
|
>{{ itemn.attr }}</view
|
||||||
|
>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="cart">
|
<view class="cart">
|
||||||
<view class="title">数量</view>
|
<view class="title">数量</view>
|
||||||
<view class="carnum acea-row row-left">
|
<view class="carnum acea-row row-left">
|
||||||
<view class="item reduce" :class="cartNum <= 1 ? 'on' : ''" @click="CartNumDes">-</view>
|
<view
|
||||||
|
class="item reduce"
|
||||||
|
:class="cartNum <= 1 ? 'on' : ''"
|
||||||
|
@click="CartNumDes"
|
||||||
|
>-</view
|
||||||
|
>
|
||||||
<view class="item num">{{ cartNum }}</view>
|
<view class="item num">{{ cartNum }}</view>
|
||||||
<view
|
<view
|
||||||
class="item plus"
|
class="item plus"
|
||||||
:class="
|
:class="cartNum >= attr.productSelect.stock ? 'on' : ''"
|
||||||
cartNum >= attr.productSelect.stock
|
|
||||||
? 'on'
|
|
||||||
: ''
|
|
||||||
"
|
|
||||||
@click="CartNumAdd"
|
@click="CartNumAdd"
|
||||||
>+</view>
|
>+</view
|
||||||
|
>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="mask" @touchmove.prevent :hidden="attr.cartAttr === false" @click="closeAttr"></view>
|
<view
|
||||||
|
class="mask"
|
||||||
|
@touchmove.prevent
|
||||||
|
:hidden="attr.cartAttr === false"
|
||||||
|
@click="closeAttr"
|
||||||
|
></view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
@ -114,6 +126,12 @@ export default {
|
|||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
},
|
},
|
||||||
|
previewImage() {
|
||||||
|
uni.previewImage({
|
||||||
|
current: 0,
|
||||||
|
urls: [this.attr.productSelect.image],
|
||||||
|
});
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
Reference in New Issue
Block a user