why does mytrip send multiple requests when i call only once?

After many hours of searching, I found out that the key that is assigned to the Component caused the problem.

When the key is modified the GET request will send again. This the reason why it sends twice. Special thanks to @Anatoly for giving me the hint.


Below is the usage codes:

<template>
    <Component :key="componentKey" @edit="dataIsChanged"/>
</template>

<script>
export default {
    components: { Component },

    data: () => ({
        componentKey: 0,
    }),
    
    methods: {
        dataIsChanged: function() {
            this.componentKey = Math.random();
        }
    }
};
</script>

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top