-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathPropsTable.vue
117 lines (105 loc) · 2.09 KB
/
PropsTable.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<template>
<v-row :id="sectionId">
<v-col cols="12">
<h3 :class="classes.h3">
<a
:class="classes.headerA"
:href="`#${sectionId}`"
>#</a>
{{ sectionTitle }}
</h3>
<div
v-if="subtitle"
v-html="subtitle"
></div>
</v-col>
</v-row>
<v-row>
<v-col cols="12">
<v-card>
<v-card-title>
<v-text-field
v-model="search"
append-icon="mdi:mdi-magnify"
hide-details
label="Search"
single-line
variant="underlined"
></v-text-field>
</v-card-title>
<v-data-table
:headers="headers"
hide-default-footer
:items="items"
:items-per-page="-1"
:search="search"
:sort-by="[{ key: 'name', order: 'asc' }]"
>
<template #[`item.name`]="{ item }">
<td>
<span
:id="`props-${sectionId ? `${sectionId}-${item.name}` : item.name}`"
class="name-item text-mono ml-n2"
>
<span class="text-primary">#</span>
<a
class="text-primary"
:class="classes.appLink"
:href="`#props-${sectionId ? `${sectionId}-${item.name}` : item.name}`"
>{{ item.name }}</a>
</span>
</td>
</template>
<template #[`item.type`]="{ item }">
<td
class="text-success"
v-html="item.type"
></td>
</template>
<template #[`item.default`]="{ item }">
<td
class="text-accent"
v-html="item.default"
></td>
</template>
<template #[`item.desc`]="{ item }">
<td v-html="item.desc"></td>
</template>
</v-data-table>
</v-card>
</v-col>
</v-row>
</template>
<script setup>
import { inject } from 'vue';
const classes = inject('classes');
defineProps({
headers: {
default: () => [],
type: Array,
},
items: {
default: () => [],
type: Array,
},
sectionId: {
default: '',
type: String,
},
sectionTitle: {
default: null,
type: String,
},
subtitle: {
default: null,
type: String,
},
});
const search = ref('');
</script>
<style lang="scss" scoped>
td {
padding-bottom: 10px !important;
padding-top: 10px !important;
}
</style>