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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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