2019-02-02 20:11:36 +01:00
|
|
|
import StillImage from '../still-image/still-image.vue'
|
|
|
|
|
|
|
|
const UserAvatar = {
|
|
|
|
props: [
|
2019-05-01 16:33:56 +02:00
|
|
|
'user',
|
2019-02-02 21:33:02 +01:00
|
|
|
'betterShadow',
|
|
|
|
'compact'
|
2019-02-02 20:11:36 +01:00
|
|
|
],
|
|
|
|
data () {
|
|
|
|
return {
|
2020-07-08 12:11:17 +02:00
|
|
|
showPlaceholder: false,
|
|
|
|
defaultAvatar: `${this.$store.state.instance.server + this.$store.state.instance.defaultAvatar}`
|
2019-02-02 20:11:36 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
StillImage
|
|
|
|
},
|
|
|
|
methods: {
|
2020-07-08 12:11:17 +02:00
|
|
|
imgSrc (src) {
|
|
|
|
return (!src || this.showPlaceholder) ? this.defaultAvatar : src
|
|
|
|
},
|
2019-02-02 20:11:36 +01:00
|
|
|
imageLoadError () {
|
|
|
|
this.showPlaceholder = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default UserAvatar
|