1
1
<template >
2
- <v-container class =" fill-height" >
3
- <v-responsive
4
- class =" align-centerfill-height mx-auto"
5
- max-width =" 900"
6
- >
7
- <v-row >
8
- <v-col cols =" 12" >
9
- <v-form >
10
- <v-text-field
11
- v-model =" form.search"
12
- label =" search"
13
- />
14
- <v-checkbox
15
- v-model =" form.is_answered"
16
- label =" is Answered"
17
- />
18
- </v-form >
19
- </v-col >
20
- </v-row >
21
- <v-row >
22
- <v-col cols =" 12" >
23
- <v-card
24
- class =" py-4"
25
- rounded =" lg"
26
- variant =" outlined"
27
- >
28
- <template #text >
29
- <v-data-table
30
- :items =" items"
31
- :page =" vuetifyOptions.page"
32
- :items-per-page =" vuetifyOptions.itemsPerPage"
33
- :sort-by =" vuetifyOptions.sortBy"
34
- v-model:options =" vuetifyOptions"
35
- />
36
- </template >
37
- </v-card >
38
- </v-col >
39
- </v-row >
40
- </v-responsive >
41
- </v-container >
2
+ <v-row >
3
+ <v-col cols =" 12" >
4
+ <v-form >
5
+ <v-text-field
6
+ v-model =" form.search"
7
+ label =" search"
8
+ />
9
+ <v-checkbox
10
+ v-model =" form.is_answered"
11
+ label =" is Answered"
12
+ />
13
+ </v-form >
14
+ </v-col >
15
+ </v-row >
16
+ <v-row >
17
+ <v-col cols =" 12" >
18
+ <v-card
19
+ class =" py-4"
20
+ rounded =" lg"
21
+ variant =" outlined"
22
+ >
23
+ <template #text >
24
+ <v-data-table
25
+ v-model:options =" vuetifyOptions"
26
+ :items =" items"
27
+ :page =" vuetifyOptions.page"
28
+ :items-per-page =" vuetifyOptions.itemsPerPage"
29
+ :sort-by =" vuetifyOptions.sortBy"
30
+ />
31
+ </template >
32
+ </v-card >
33
+ </v-col >
34
+ </v-row >
42
35
</template >
43
36
44
37
<script setup lang="ts">
45
38
import { ref } from ' vue' ;
46
39
import useDatatableUrlSync from ' ../../../src/useDatatableUrlSync' ;
47
- import type { GenericDictionnary , VDUSDatatableOptions , VDUSFormSchema } from ' ../../../src/utils/VDUSTypes' ;
40
+ import type { GenericDictionnary , VDUSDatatableOptions , VDUSFormSchema , VDUSConfiguration } from ' ../../../src/utils/VDUSTypes' ;
48
41
// import useDatatableUrlSync from 'vue-datatable-url-sync';
49
42
// import type { GenericDictionnary, VDUSDatatableOptions, VDUSFormSchema } from 'vue-datatable-url-sync/src/utils/VDUSTypes';
50
43
import fakeData from " ../assets/data/data.js" ;
@@ -56,6 +49,14 @@ type FakeDataItem = {
56
49
is_answered: boolean ;
57
50
};
58
51
52
+ // --------------------- PROPS ------------------------------------
53
+ const props = defineProps ({
54
+ prefix: {
55
+ type: String ,
56
+ default: " "
57
+ },
58
+ })
59
+
59
60
// --------------------- DATA ------------------------------------
60
61
const form = ref <GenericDictionnary >({
61
62
search: " " ,
@@ -68,10 +69,15 @@ const options = ref<VDUSDatatableOptions>({
68
69
ordering: []
69
70
});
70
71
72
+ const configurations = ref <VDUSConfiguration >({
73
+ prefix: props .prefix ,
74
+ serveurDefaultPageSize: 10 ,
75
+ })
76
+
71
77
const items = ref <FakeDataItem []>([]);
72
78
73
79
const formSchema = ref <VDUSFormSchema >({
74
- is_answered: { type: " boolean" }
80
+ is_answered: { type: " boolean" },
75
81
});
76
82
77
83
// --------------------- METHODS ------------------------------------
@@ -121,5 +127,5 @@ const fetchDatas = (queryParams: string, queryAsObject: GenericDictionnary) => {
121
127
};
122
128
123
129
// --------------------- CREATED ------------------------------------
124
- const {vuetifyOptions} = useDatatableUrlSync (useRoute (), useRouter (), form , fetchDatas , options , formSchema .value );
130
+ const {vuetifyOptions} = useDatatableUrlSync (useRoute (), useRouter (), form , fetchDatas , options , formSchema .value , null , configurations . value );
125
131
</script >
0 commit comments