<template>
  <div class="elem-image" :style="styles">
    <img :src="imageSrc" alt="图片" v-if="imageSrc" />
    <p v-else><i class="el-icon-picture"></i></p>
  </div>
</template>

<script>
export default {
  name: "elem-image",
  props: {
    data: {
      type: Object,
    },
  },
  computed: {
    styles() {
      return {
        borderStyle: this.data.borderStyle,
        borderColor: this.data.borderColor,
      };
    },
    imageSrc() {
      const content =
        this.data.content &&
        this.data.content[0] &&
        this.data.content[0].content;

      return content && content.indexOf("base64") !== -1 ? content : "";
    },
  },
  data() {
    return {};
  },
  methods: {},
};
</script>
