0👍
It is likely that isMandatory
‘s value is changing depending on the response from the API call you are making. When the page is first loaded, it will be whatever default value you gave it, and when the API returns a response later, the page isn’t being refreshed.
I would need more information on how your code is structured, but my current guess is that you need to turn your isMandatory
into a ref
.
For example, if your code looks something like this:
<script setup>
isMandatory = false;
// -> some API call handling
isMandatory = apiResponse
</script>
<template>
...
</template>
Turn it into something like:
<script setup>
isMandatory = ref(false);
// -> some API call handling
isMandatory.value = apiResponse
</script>
<template>
...
</template>
Then template
will reactively change whenever the value of isMandatory
changes.
- [Vuejs]-Add post affiliate pro Track (vue frontend)
- [Vuejs]-How can I make the child menus of v-navigation-drawer component on at the first project run?
Source:stackexchange.com