mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-05 21:53:56 +00:00
42 lines
888 B
Vue
42 lines
888 B
Vue
<template>
|
|
<div>
|
|
<table class="table table-bordered">
|
|
<thead>
|
|
<tr>
|
|
<th>Avatar</th>
|
|
<th>Name</th>
|
|
<th>Title</th>
|
|
<th>Profile</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr v-for="(user, key) in users">
|
|
<td>
|
|
<nuxt-link :to="{ path: `/users/${key}`}">
|
|
<img :src="user.avatar" class="rounded" alt="avatar">
|
|
</nuxt-link>
|
|
</td>
|
|
<td>{{ user.name }}</td>
|
|
<td>{{ user.title }}</td>
|
|
<td>
|
|
<nuxt-link :to="{ path: `/users/${key}`}">View profile →</nuxt-link>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import axios from '~plugins/axios'
|
|
|
|
export default {
|
|
async data() {
|
|
const { data } = await axios.get('users.json')
|
|
return {
|
|
users: data
|
|
}
|
|
}
|
|
}
|
|
</script>
|