<template>
  <div class="img-flex">
    <el-image
      :src="urlVal(item)"
      :preview-src-list="[urlVal(item)]"
      alt=""
      v-for="item in fileList"
      :key="item"
    />
  </div>
</template>
<script>
const baseUrl = process.env.VUE_APP_API_BASE_URL + "/";
const zwfwUrl = process.env.VUE_APP_API_ZWFW_URL + "/";

export default {
  props: ["src"],
  data() {
    return {};
  },
  created() {},
  computed: {
    fileList: function(v) {
      return this.src ? this.src.split(",") : [];
    },
  },
  methods: {
    urlVal(val) {
      return val.indexOf("zwfw_api_xnjc") == -1
        ? val.indexOf("http") == -1
          ? (val = baseUrl + val)
          : (val = val)
        : (val = zwfwUrl + val);
    },
  },
};
</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>
