-
-
Notifications
You must be signed in to change notification settings - Fork 445
/
Users.vue
50 lines (45 loc) · 1.33 KB
/
Users.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<script lang="ts">
import Layout from '../Components/Layout.vue'
export default { layout: Layout }
</script>
<script setup lang="ts">
import { Head, router, usePage } from '@inertiajs/vue3'
import { onMounted } from 'vue'
const page = usePage()
defineProps({ users: Array })
onMounted(() => {
router.reload({
only: ['users'],
})
})
</script>
<template>
<Head title="User" />
<button></button>
<h1 class="text-3xl">Users</h1>
<div class="my-4 border p-4">
<div><strong>Using $page.props:</strong> {{ $page.props.appName }}</div>
<div><strong>Using usePage():</strong> {{ page.props.appName }}</div>
</div>
<div class="mt-6 w-full max-w-2xl overflow-hidden rounded border shadow-sm">
<table class="w-full text-left">
<thead>
<tr>
<th class="px-4 py-2">Id</th>
<th class="px-4 py-2">Name</th>
<th class="px-4 py-2">Email</th>
</tr>
</thead>
<tbody>
<tr v-if="users" v-for="user in users" :key="user.id" class="border-t">
<td class="px-4 py-2">{{ user.id }}</td>
<td class="px-4 py-2">{{ user.name }}</td>
<td class="px-4 py-2">{{ user.email }}</td>
</tr>
<tr v-else="users" class="border-t">
<td class="px-4 py-2" colspan="3">Loading...</td>
</tr>
</tbody>
</table>
</div>
</template>