v2.5.2
Giriş yap

vuejs de setup kısmında methods içerisinde ki bir fonksiyonu çalıştırma

rotaile
180 defa görüntülendi ve 1 kişi tarafından değerlendirildi

arkadaşlar kolay gelsin. vuejs 3 ile bir proje yazıyorum. vuejs te yeniyim. inertia ile bir form post ediyorum. şu şekilde,

   <script setup>

function postStore() {
    router.post('/akis-gonderiler/gonderi-ekle', post, {
        onFinish: () => { processingPost.value = false },
        onStart: () => { processingPost.value = true },
        onSuccess: () => {
            postSuccess()
            post.content = null;
            
            *//bu alanda loadPosts() fonksiyonunu çalıştırmak istiyorum*

        },
        onError: postError,

    }),
        processingPost.value = true
}
</script>

<template>
    //içerikler
</template>


<script>

methods: {

async loadPosts() {
            await axios.get('/api/akis-gonderiler', {
                params: {
                    limit: 5
                }
            })
                .then(response => {
                    this.posts = response.data.posts
                })
                .catch(error => {
                    console.log(error)
                });
        },
}
<script>
Cevap yaz
Cevaplar (0)
Henüz kimse cevap yazmadı. İlk cevap yazan sen ol!