<template>
  <el-image class="pointer radius" :style="{ width: size, height: size }" style="min-width: 40px;" :src="avatar"
    fit="cover" :preview-src-list="enablePreview ? [avatar] : null" />
</template>

<script setup>
import defAva from '@/assets/images/profile.jpg'
const props = defineProps({
  src: {
    type: String,
    default: "http://uworkplace.cn/img/uice.jpg",
  }, // 背景图
  size: {
    type: String,
    default: "50px",
  },
  enablePreview: {
    type: Boolean,
    default: true
  }
});
const { src } = toRefs(props)
const avatar = computed(() => (src.value == "" || src.value == null) ? defAva : import.meta.env.VITE_APP_BASE_API + src.value)
</script>
