I am using Vue and have a method in my file called load.js
.
async function loadTask(x) {
return await x; // Some async code
}
export { loadTask };
In one of my Vue components, I call the method but encounter an issue where the use of await
prevents the <template>
from loading. When I remove the await
, the code below executes successfully. Can you help me understand what I might be missing?
<script setup>
import { loadTask } from './methods/load.js';
const test = loadTask(3);
console.log(await test);
</script>
<template>
<div>This section does not render properly.</div>
</template>