<!--
 * @Author: micky
 * @Date: 2024-08-19 12:01:35
 * @LastEditors: micky
 * @LastEditTime: 2024-10-14 11:33:43
 * @FilePath: \chargingpile-uniapp\src\components\widgets\image-list\image-list.vue
-->
<template>
    <view class="image-list flex flex-wrap !w-full" v-if="imgStr">
        <u-image
            v-for="(item, index) in imgStr?.split(',')"
            :key="index"
            :src="item"
            width="60"
            height="60"
            radius="3"
            class="mr-2 my-1 w-[60px]"
            @click="previewImage(index)"
        ></u-image>
    </view>
    <view v-else class="text-[#939598]">暂无</view>
</template>

<script setup lang="ts">
const props = defineProps({
    imgStr: String
})
const previewImage = (current: number) => {
    const imgArr = props.imgStr?.split(',') as string[]
    uni.previewImage({
        current,
        urls: imgArr
    })
}
</script>
<style scoped lang="scss"></style>
