<template>
  <el-image
    :src="actionUrl + fileUrl"
    class="image-preview"
    @error="$emit('onError')"
    @load="$emit('onLoad')"
  ></el-image>
</template>

<script>
export default {
  name: 'ImagePreview',
  props: {
    fileUrl: {
      default: '',
      type: String
    }
  },
  computed: {
    actionUrl: _ => window.context.portal,
    imageUrl() {
      return this.actionUrl + this.fileUrl
    }
  }
}
</script>

<style lang="scss" scoped>
.image-preview {
  width: 100%;
  height: 100%;
}
</style>
