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