You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
2.8 KiB
Vue

<template>
<view>
<u-popup :closeable="true"
:show="showImg"
mode="center"
@close="dialogClose">
<view style="height: 1130rpx;width:684rpx"
class="row items-center justify-center">
<u--image :src="imageUrlArr[activeIdx]"
style="margin-top:70rpx"
width="606rpx"
height="938rpx"></u--image>
<view class="col-10 fl-mt-xs row items-center fl-mb-md">
<view style="border-radius:4rpx;width:30rpx;height:30rpx;background: #EBEBEB;"
class="row items-center justify-center">
<u-image src="../../static/arrow-left.png"
width="10rpx"
height="20rpx"
style="margin-right:10rpx"
@click="handleLeftClick"></u-image>
</view>
<view style="width:calc(100% - 80rpx);flex-flow: nowrap;overflow: auto;"
class="row">
<u-image v-for="(img,imgIdx) in imageUrlArr"
:key="imgIdx"
:src="img"
style="margin: 8rpx 0 0 16rpx"
width="60rpx"
height="60rpx"
@click="activeIdx=imgIdx"></u-image>
</view>
<u-image src="../../static/arrow-right.png"
width="30rpx"
height="30rpx"
style="margin-left:10rpx"
@click="handleRightClick"></u-image>
</view>
</view>
</u-popup>
</view>
</template>
<script>
export default {
props: {
pimageUrl: String,
pimageUrlArr: Array,
pactiveIdx: Number,
pshowImg: Boolean,
},
data () {
return {
showImg: false,
activeIdx: 0,
imageUrlArr: [],
};
},
created () {
this.imageUrlArr = this.pimageUrlArr;
this.activeIdx = this.pactiveIdx;
},
watch: {
pimageUrlArr () {
this.imageUrlArr = this.pimageUrlArr;
},
pactiveIdx () {
this.activeIdx = this.pactiveIdx;
},
pshowImg () {
this.showImg = this.pshowImg;
},
activeIdx () {
this.$emit("triggerShowActiveImgChange", this.activeIdx);
},
},
onShow () {
this.showImg = false
},
methods: {
dialogClose () {
this.showImg = false;
this.$emit("triggerShowImgClose");
},
handleLeftClick () {
if (this.activeIdx > 0) {
this.activeIdx = this.activeIdx - 1
}
},
handleRightClick () {
if (this.activeIdx < this.imageUrlArr.length - 1) {
this.activeIdx = this.activeIdx + 1
}
},
},
};
</script>
<style lang="scss" scoped>
::v-deep .u-popup__content__close--top-right {
border-radius: 50%;
border: solid 1px #777171;
padding: 3px;
top: 8px;
right: 15px;
}
</style>