<template>
  <el-image @click="viewClick" :src="src" :fit="fit" :lazy="lazy" :scroll-container="scrollContainer" :preview-src-list="previewSrcList" :z-index="zIndex">
    <template v-slot:error>
        <slot name="error" />
      </template>
  </el-image>
</template>

<script>
export default {
  name: 'DmElImageView',
  props: {
    src: String,
    fit: String,
    lazy: Boolean,
    scrollContainer: {},
    previewSrcList: {
      type: Array,
      default: () => []
    },
    zIndex: {
      type: Number,
      default: 2000
    }
  },
  methods: {
    viewClick() {
      this.$emit('click');
      document.body.style = ''; // 原生js清除body样式
    }
  },
};
</script>