diff --git a/components/ui/Avatar.vue b/components/ui/Avatar.vue index 98b6c0343..665f4cb96 100644 --- a/components/ui/Avatar.vue +++ b/components/ui/Avatar.vue @@ -2,10 +2,13 @@ { - if (this.$refs.img.naturalWidth < 96 && this.$refs.img.naturalWidth > 0) { - this.$refs.img.style.imageRendering = 'pixelated' - } - } - - if (this.$refs.img.naturalWidth) { - isPixelated() - } else { - this.$refs.img.onload = isPixelated - } + data() { + return { + pixelated: false, } }, + methods: { + updatePixelated() { + if (this.$refs.img && this.$refs.img.naturalWidth && this.$refs.img.naturalWidth <= 96) { + this.pixelated = true + } else { + this.pixelated = false + } + }, + }, } @@ -116,5 +118,9 @@ export default { &.no-shadow { box-shadow: none; } + + &.pixelated { + image-rendering: pixelated; + } }