<template>
  <div>
    <img v-if="imgSrc" :src="imgSrc" alt="" :onerror="defalutUrl">
    <img v-else src="@/assets/common/head_default.jpg" alt="">
  </div>
</template>

<script>
export default {
  props: {
    imgSrc: String,
  },
  data() {
    return {
      defalutUrl: 'this.src="' + require('@/assets/common/head_default.jpg') + '"',
    }
  },
}
</script>

<style lang="scss" scoped>
div {
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: url('@/assets/common/Picture frame .png') no-repeat;
  background-size: 100% 100%;
  padding: 3px;
  img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
  }
}
</style>