index.vue 1.17 KB
<template>
  <view class="booth-map-gallery-page">
    <view class="booth-map-gallery-grid">
      <view
        v-for="(item, index) in imageList"
        :key="item.id"
        class="booth-map-gallery-item"
        @click="previewImage(index)"
      >
        <image class="booth-map-gallery-image" :src="item.url" :mode="item.mode || 'widthFix'" />
      </view>
    </view>
  </view>
</template>

<script setup>
import { ref } from 'vue'
import Taro from '@tarojs/taro'
import './index.less'

const imageList = ref([
  {
    id: 'booth-01',
    url: 'https://cdn.ipadbiz.cn/lls_prog/images/check_detail_img.png?imageMogr2/strip/quality/60',
    mode: 'widthFix',
  },
  {
    id: 'booth-02',
    url: 'https://cdn.ipadbiz.cn/lls_prog/images/welcome_8.jpg?imageMogr2/strip/quality/60',
    mode: 'widthFix',
  },
  {
    id: 'booth-03',
    url: 'https://cdn.ipadbiz.cn/lls_prog/images/check_detail_img.png?imageMogr2/strip/quality/60',
    mode: 'widthFix',
  },
])

const previewImage = index => {
  Taro.previewImage({
    current: imageList.value[index].url,
    urls: imageList.value.map(item => item.url),
  })
}
</script>

<script>
export default {
  name: 'BoothMapGallery',
}
</script>