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