yandere_fe/src/components/user_avatar/user_avatar.js

31 lines
534 B
JavaScript

import StillImage from '../still-image/still-image.vue'
import avatarPlaceholderImage from '../../assets/avatar-placeholder.png'
const UserAvatar = {
props: [
'src',
'betterShadow',
'compact'
],
data () {
return {
showPlaceholder: false
}
},
components: {
StillImage
},
computed: {
imgSrc () {
return this.showPlaceholder ? avatarPlaceholderImage : this.src
}
},
methods: {
imageLoadError () {
this.showPlaceholder = true
}
}
}
export default UserAvatar