79547594

Date: 2025-04-01 02:17:03
Score: 1
Natty:
Report link

Just facing the same problem, so I solved to use the method with 'async' and 'await' into 'onBeforeMount'.

<script setup>
import { ref, computed, onBeforeMount } from 'vue';
const valueThatIsFilledInBeforeMount = ref('')
const deffer =  async () => {
   valueThatIsFilledInBeforeMount.value = 1;
};
onBeforeMount(() => {
   console.log("onBeforeMount")
   await deffer()
});
const myComputedProperty = computed(() => {
   return valueThatIsFilledInBeforeMount.value + 1;
})
</script>
Reasons:
  • Whitelisted phrase (-2): I solved
  • Has code block (-0.5):
  • Me too answer (2.5): facing the same problem
  • Low reputation (1):
Posted by: BRSO