assets/users.json
[
{
"id" : 1,
"name": "Alice"
},
{
"id" : 2,
"name": "Bob"
},
{
"id" : 3,
"name": "Carol"
}
]
pages/assets-json.vue
<template>
<div>
<h1>
assset API
</h1>
<h2>Users</h2>
<ul>
<li v-for="user in users" :key="user.id">
{{ user.id }} - {{ user.name }}
</li>
</ul>
</div>
</template>
<script>
export default {
asyncData() {
const users = require(`~/assets/users.json`)
return {
users
}
}
}
</script>
Original by Github issue
チャットメンバー募集
何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。