Fetching JSON Data from API Calls - Build Time & Run Time #1291
Unanswered
akil-rails
asked this question in
Q&A
Replies: 1 comment 6 replies
-
Something like this can be done: # Todos
<table v-if="data?.length">
<tr v-for="{ title, completed } in data">
<td>{{ title }}</td>
<td>{{ completed ? '✅' : '⬛'}}</td>
</tr>
</table>
<script setup>
import { ref, onMounted } from 'vue'
const data = ref([])
onMounted(async () => {
const res = await fetch('https://jsonplaceholder.typicode.com/todos')
data.value = await res.json()
})
</script> |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've APIs that return JSON data that I need to include in the documentation. (Swagger files and other meta-data). The data will be used in code-blocks and in el-table (from ElementPlus).
What is the suggested way to do this?
Beta Was this translation helpful? Give feedback.
All reactions