<template>
  <u-cell :title="label">
    <template #label>
      <view class="mt-10 flex-start">
        <view v-for="(item, index) in files" :key="index" class="ml-10">
          <u-image
            show-loading
            width="100rpx"
            height="100rpx"
            :src="item.FILEPATH"
            @click="fnPreviewImage(item.FILEPATH, files)"
          />
        </view>
      </view>
    </template>
  </u-cell>
</template>

<script>
export default {
  props: {
    files: {
      type: Array,
      required: true,
    },
    label: {
      type: String,
      default: "图片",
    },
  },
  methods: {
    fnPreviewImage(src, srcArr) {
      const urls = srcArr.map((item) => item.FILEPATH);
      uni.previewImage({
        urls,
        current: src,
      });
    }
  },
}
</script>

<style scoped lang="scss"></style>
