v2.5.2
Giriş yap

vue 3 composition api $forceUpdate kullanımı

recep
813 defa görüntülendi

composition api'de this kullanamadığımız için normalde kullandığımız this.$forceUpdate olayını nasıl kullanabiliriz?

not: composition api kullandığım için script'i setup ile kullanıyorum.

Cevap yaz
Cevaplar (1)
tayfunerbilen
890 gün önce

şöyle kullanabilirsin

<template>
    ...
</template>

<script setup>
import { getCurrentInstance } from "vue"
const instance = getCurrentInstance();

// gerektiği yerde
instance.proxy.$forceUpdate();
</script>