Commit 17888a7c authored by leon's avatar leon

feat: preview image use swiper current index

parent 5c929cbf
......@@ -11,7 +11,8 @@
v-if="show"
class="swiper"
circular
:current="currentIndex"
:current="currentIndex"
@change="changed"
:style="{ height: `${height}px` }"
>
<swiper-item v-for="(item, index) in popupData" :key="index">
......@@ -39,7 +40,9 @@
export default {
name: 'ModelData',
data() {
return {}
return {
swiperIndex: -1
}
},
props: {
popupData: {
......@@ -78,16 +81,23 @@ export default {
},
methods: {
close() {
close() {
this.swiperIndex = -1
this.$emit('close')
},
seeImage(key) {
const images = this.popupData.map(item => item[key])
seeImage(key) {
if(this.swiperIndex === -1) {
this.swiperIndex = this.currentIndex
}
const images = this.popupData.map(item => item[key])
uni.previewImage({
current: this.currentIndex,
current: this.swiperIndex,
urls: images
})
}
},
changed(event) {
this.swiperIndex = event.detail.current
}
}
}
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment