-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathTableResizingExample.vue
More file actions
74 lines (70 loc) · 1.38 KB
/
TableResizingExample.vue
File metadata and controls
74 lines (70 loc) · 1.38 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<script setup lang="ts">
import type { TableColumn } from '@nuxt/ui'
interface User {
id: number
name: string
position: string
email: string
role: string
}
const data = ref<User[]>([{
id: 1,
name: 'Lindsay Walton',
position: 'Front-end Developer',
email: 'lindsay.walton@example.com',
role: 'Member'
}, {
id: 2,
name: 'Courtney Henry',
position: 'Designer',
email: 'courtney.henry@example.com',
role: 'Admin'
}, {
id: 3,
name: 'Tom Cook',
position: 'Director of Product',
email: 'tom.cook@example.com',
role: 'Member'
}, {
id: 4,
name: 'Whitney Francis',
position: 'Copywriter',
email: 'whitney.francis@example.com',
role: 'Admin'
}, {
id: 5,
name: 'Leonard Krasner',
position: 'Senior Designer',
email: 'leonard.krasner@example.com',
role: 'Owner'
}, {
id: 6,
name: 'Floyd Miles',
position: 'Principal Designer',
email: 'floyd.miles@example.com',
role: 'Member'
}])
const columns: TableColumn<User>[] = [{
accessorKey: 'id',
header: 'ID',
minSize: 200,
size: 300,
maxSize: 500
}, {
accessorKey: 'name',
header: 'Name',
maxSize: 200
}, {
accessorKey: 'email',
header: 'Email',
minSize: 225
}, {
accessorKey: 'role',
header: 'Role'
}, {
id: 'action'
}]
</script>
<template>
<UTable :data="data" :columns="columns" :column-sizing-options="{ enableColumnResizing: true }" class="flex-1" sticky />
</template>