@paris-ias/list 1.0.94 → 1.0.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json
CHANGED
|
@@ -35,18 +35,18 @@
|
|
|
35
35
|
</v-btn>
|
|
36
36
|
<template v-else>
|
|
37
37
|
<v-btn
|
|
38
|
-
:class="{ 'active-page':
|
|
38
|
+
:class="{ 'active-page': isActive }"
|
|
39
39
|
tabindex="0"
|
|
40
40
|
outlined
|
|
41
41
|
min-width="35"
|
|
42
42
|
height="35"
|
|
43
43
|
tile
|
|
44
44
|
nuxt
|
|
45
|
-
:active="
|
|
46
|
-
:color="
|
|
45
|
+
:active="isActive"
|
|
46
|
+
:color="isActive ? 'white' : 'black'"
|
|
47
47
|
text
|
|
48
48
|
width="35"
|
|
49
|
-
:aria-current="
|
|
49
|
+
:aria-current="isActive ? 'true' : 'false'"
|
|
50
50
|
:aria-label="
|
|
51
51
|
page.current
|
|
52
52
|
? `Current page, Page ${page.value}`
|
|
@@ -115,11 +115,14 @@ const props = defineProps({
|
|
|
115
115
|
required: true
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
|
+
const isActive = computed(() => {
|
|
119
|
+
return !!pages.current;
|
|
120
|
+
});
|
|
118
121
|
const renderPages = computed(() => {
|
|
119
|
-
const
|
|
122
|
+
const pages2 = [];
|
|
120
123
|
for (let pageIndex = 1; pageIndex <= props.totalPages; pageIndex++) {
|
|
121
124
|
if (pageIndex === props.currentPage || pageIndex < props.pageGap || pageIndex > props.totalPages - props.pageGap + 1) {
|
|
122
|
-
|
|
125
|
+
pages2.push(createPage(pageIndex));
|
|
123
126
|
continue;
|
|
124
127
|
}
|
|
125
128
|
let minimum;
|
|
@@ -135,27 +138,27 @@ const renderPages = computed(() => {
|
|
|
135
138
|
maximum = props.currentPage + props.pagePadding;
|
|
136
139
|
}
|
|
137
140
|
if (pageIndex >= minimum && pageIndex <= props.currentPage || pageIndex >= props.currentPage && pageIndex <= maximum) {
|
|
138
|
-
|
|
141
|
+
pages2.push(createPage(pageIndex));
|
|
139
142
|
continue;
|
|
140
143
|
}
|
|
141
144
|
if (pageIndex === props.pageGap) {
|
|
142
145
|
if (minimum > props.pageGap + 1 && props.currentPage > props.pageGap + props.pagePadding + 1) {
|
|
143
|
-
|
|
146
|
+
pages2.push(createGap(pageIndex));
|
|
144
147
|
} else {
|
|
145
|
-
|
|
148
|
+
pages2.push(createPage(pageIndex));
|
|
146
149
|
}
|
|
147
150
|
continue;
|
|
148
151
|
}
|
|
149
152
|
if (pageIndex === props.totalPages - props.pageGap + 1) {
|
|
150
153
|
if (maximum < props.totalPages - props.pageGap && props.currentPage < props.totalPages - props.pageGap - props.pagePadding) {
|
|
151
|
-
|
|
154
|
+
pages2.push(createGap(pageIndex));
|
|
152
155
|
} else {
|
|
153
|
-
|
|
156
|
+
pages2.push(createPage(pageIndex));
|
|
154
157
|
}
|
|
155
158
|
continue;
|
|
156
159
|
}
|
|
157
160
|
}
|
|
158
|
-
return
|
|
161
|
+
return pages2;
|
|
159
162
|
});
|
|
160
163
|
const createPage = (pageIndex) => {
|
|
161
164
|
return {
|
|
@@ -187,6 +187,10 @@ export const useRootStore = defineStore("rootStore", {
|
|
|
187
187
|
},
|
|
188
188
|
updatePage({ page, type }) {
|
|
189
189
|
this.page = page;
|
|
190
|
+
const router = useRouter();
|
|
191
|
+
const query = router.currentRoute.value.query;
|
|
192
|
+
query.page = page > 1 ? page.toString() : void 0;
|
|
193
|
+
router.replace({ query });
|
|
190
194
|
this.update(type);
|
|
191
195
|
},
|
|
192
196
|
async updateSearch({
|