Fix convertion to Composition API for Avatar component (#1391)

* Fix Convertion for Avatar component

* Use ref for img
This commit is contained in:
Mysterious_Dev
2023-10-02 13:08:56 +02:00
committed by GitHub
parent a6766ef1c0
commit fcfa508cbc

View File

@@ -36,6 +36,7 @@
<script setup> <script setup>
const pixelated = ref(false) const pixelated = ref(false)
const img = ref(null)
defineProps({ defineProps({
src: { src: {
@@ -72,10 +73,10 @@ defineProps({
}) })
function updatePixelated() { function updatePixelated() {
if (this.$refs.img && this.$refs.img.naturalWidth && this.$refs.img.naturalWidth <= 96) { if (img.value && img.value.naturalWidth && img.value.naturalWidth <= 96) {
this.pixelated = true pixelated.value = true
} else { } else {
this.pixelated = false pixelated.value = false
} }
} }
</script> </script>