diff options
Diffstat (limited to 'src/components/user_avatar/user_avatar.js')
| -rw-r--r-- | src/components/user_avatar/user_avatar.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/components/user_avatar/user_avatar.js b/src/components/user_avatar/user_avatar.js new file mode 100644 index 00000000..bfa2c2b5 --- /dev/null +++ b/src/components/user_avatar/user_avatar.js @@ -0,0 +1,28 @@ +import StillImage from '../still-image/still-image.vue' +import nsfwImage from '../../assets/nsfw.png' + +const UserAvatar = { + props: [ + 'src' + ], + data () { + return { + showPlaceholder: false + } + }, + components: { + StillImage + }, + computed: { + imgSrc () { + return this.showPlaceholder ? nsfwImage : this.src + } + }, + methods: { + imageLoadError () { + this.showPlaceholder = true + } + } +} + +export default UserAvatar |
