<template>
  <div class="img-flex" v-if="fileList && fileList.length > 0">
    <el-image
      :preview-src-list="urlVal(fileList)"
      :src="require('../assets/images/picture.png')"
    >
    </el-image>
    <!-- <el-image
      :preview-src-list="[urlVal(item)]"
      v-for="item in fileList"
      :key="item"
    >
   
      <div slot="error" class="image-slot">
        <i class="el-icon-picture-outline" @click="handleClick"></i>
      </div>
    </el-image> -->
  </div>
  <p v-else>--</p>
</template>
<script>
const baseUrl = process.env.VUE_APP_API_BASE_URL + "/";
const zwfwUrl = process.env.VUE_APP_API_ZWFW_URL + "/";
export default {
  props: ["src", "row", "fileList"],
  data() {
    return {
      // fileList: [],
    };
  },
  created() {},
  computed: {},
  methods: {
    // handleClick() {
    //   this.fileList = [];
    //   if (this.row.snapPath && this.row.filePaths) {
    //     this.src = this.row.snapPath + this.row.filePaths;
    //   } else {
    //     if (this.row.snapPath) {
    //       this.src = this.row.snapPath;
    //     } else {
    //       this.src = this.row.filePaths;
    //     }
    //   }
    //   this.fileList = this.src ? this.src.split(",") : [];
    //   this.fileList &&
    //     this.fileList.forEach((val) => {
    //       val.indexOf("zwfw_api_xnjc") == -1
    //         ? val.indexOf("http") == -1
    //           ? (val = baseUrl + val)
    //           : (val = val)
    //         : (val = zwfwUrl + val);
    //     });
    // },
    urlVal(arr) {
      let Arr = [];
      arr.length > 0 &&
        arr.forEach((val) => {
          if (val.indexOf("zwfw_api_xnjc") == -1) {
            if (val.indexOf("http") == -1) {
              val = baseUrl + val;
              Arr.push(val);
            } else {
              Arr.push(val);
            }
          } else {
            val = zwfwUrl + val;
            Arr.push(val);
          }
          // val.indexOf("zwfw_api_xnjc") == -1
          //   ? val.indexOf("http") == -1
          //     ? (val = baseUrl + val)
          //     : (val = val)
          //   : (val = zwfwUrl + val);
        });
      return Arr;
    },
  },
};
</script>
<style lang="less" scoped>
.img-flex {
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  .el-image {
    width: 50px;
    float: left;
    border: 1px solid #ddd;
    margin: 2px;
  }
}
</style>
