@fy-/fws-vue 0.8.0 → 0.8.2
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/components/ui/DefaultPaging.vue +20 -23
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import type { APIPaging } from "../../composables/rest";
|
|
12
12
|
import { useEventBus } from "../../composables/event-bus";
|
|
13
13
|
import { useServerRouter } from "../../stores/serverRouter";
|
|
14
|
-
import { useRoute } from "vue-router";
|
|
14
|
+
import { LocationQueryValue, RouteLocationRaw, useRoute } from "vue-router";
|
|
15
15
|
import { useFyHead } from "@fy-/head";
|
|
16
16
|
import { hasFW, getURL } from "@fy-/fws-js";
|
|
17
17
|
|
|
@@ -42,24 +42,35 @@ const next = () => {
|
|
|
42
42
|
const page = props.items.page_no + 1;
|
|
43
43
|
|
|
44
44
|
if (!isNewPage(page)) return;
|
|
45
|
-
|
|
45
|
+
const newQuery = { ...route.query };
|
|
46
|
+
newQuery.page = page.toString();
|
|
46
47
|
history.push({
|
|
47
48
|
path: history.currentRoute.path,
|
|
48
|
-
query:
|
|
49
|
+
query: newQuery,
|
|
49
50
|
hash: props.hash != "" ? props.hash : undefined,
|
|
50
51
|
});
|
|
51
52
|
};
|
|
52
53
|
const prev = () => {
|
|
53
54
|
const page = props.items.page_no - 1;
|
|
54
55
|
if (!isNewPage(page)) return;
|
|
55
|
-
|
|
56
|
+
const newQuery = { ...route.query };
|
|
57
|
+
newQuery.page = page.toString();
|
|
56
58
|
history.push({
|
|
57
59
|
path: history.currentRoute.path,
|
|
58
|
-
query:
|
|
60
|
+
query: newQuery,
|
|
59
61
|
hash: props.hash != "" ? props.hash : undefined,
|
|
60
62
|
});
|
|
61
63
|
};
|
|
62
64
|
|
|
65
|
+
const page = (page: number): RouteLocationRaw => {
|
|
66
|
+
const newQuery = { ...route.query };
|
|
67
|
+
newQuery.page = page.toString();
|
|
68
|
+
return {
|
|
69
|
+
path: history.currentRoute.path,
|
|
70
|
+
query: newQuery,
|
|
71
|
+
hash: props.hash != "" ? props.hash : undefined,
|
|
72
|
+
};
|
|
73
|
+
};
|
|
63
74
|
const currentUrl = computed(() => {
|
|
64
75
|
/*
|
|
65
76
|
const url = getURL();
|
|
@@ -154,9 +165,7 @@ useFyHead({
|
|
|
154
165
|
<li v-if="items.page_no - 2 > 1">
|
|
155
166
|
<router-link
|
|
156
167
|
class="flex items-center justify-center px-3 h-8 leading-tight text-fv-neutral-500 bg-white border border-fv-neutral-300 hover:bg-fv-neutral-100 hover:text-fv-neutral-700 dark:bg-fv-neutral-800 dark:border-fv-neutral-700 dark:text-fv-neutral-400 dark:hover:bg-fv-neutral-700 dark:hover:text-white"
|
|
157
|
-
:to="
|
|
158
|
-
currentUrl + '1' + (props.hash != '' ? `#${props.hash}` : '')
|
|
159
|
-
"
|
|
168
|
+
:to="page(1)"
|
|
160
169
|
>
|
|
161
170
|
1
|
|
162
171
|
</router-link>
|
|
@@ -176,11 +185,7 @@ useFyHead({
|
|
|
176
185
|
>
|
|
177
186
|
<router-link
|
|
178
187
|
class="flex items-center justify-center px-3 h-8 leading-tight text-fv-neutral-500 bg-white border border-fv-neutral-300 hover:bg-fv-neutral-100 hover:text-fv-neutral-700 dark:bg-fv-neutral-800 dark:border-fv-neutral-700 dark:text-fv-neutral-400 dark:hover:bg-fv-neutral-700 dark:hover:text-white"
|
|
179
|
-
:to="
|
|
180
|
-
currentUrl +
|
|
181
|
-
(items.page_no - (3 - i)) +
|
|
182
|
-
(props.hash != '' ? `#${props.hash}` : '')
|
|
183
|
-
"
|
|
188
|
+
:to="page(items.page_no - (3 - i))"
|
|
184
189
|
>
|
|
185
190
|
{{ items.page_no - (3 - i) }}
|
|
186
191
|
</router-link>
|
|
@@ -201,11 +206,7 @@ useFyHead({
|
|
|
201
206
|
>
|
|
202
207
|
<router-link
|
|
203
208
|
class="flex items-center justify-center px-3 h-8 leading-tight text-fv-neutral-500 bg-white border border-fv-neutral-300 hover:bg-fv-neutral-100 hover:text-fv-neutral-700 dark:bg-fv-neutral-800 dark:border-fv-neutral-700 dark:text-fv-neutral-400 dark:hover:bg-fv-neutral-700 dark:hover:text-white"
|
|
204
|
-
:to="
|
|
205
|
-
currentUrl +
|
|
206
|
-
(items.page_no + i) +
|
|
207
|
-
(props.hash != '' ? `#${props.hash}` : '')
|
|
208
|
-
"
|
|
209
|
+
:to="page(items.page_no + i)"
|
|
209
210
|
>
|
|
210
211
|
{{ items.page_no + i }}
|
|
211
212
|
</router-link>
|
|
@@ -221,11 +222,7 @@ useFyHead({
|
|
|
221
222
|
<li v-if="items.page_no + 2 < items.page_max">
|
|
222
223
|
<router-link
|
|
223
224
|
class="flex items-center justify-center px-3 h-8 leading-tight text-fv-neutral-500 bg-white border border-fv-neutral-300 hover:bg-fv-neutral-100 hover:text-fv-neutral-700 dark:bg-fv-neutral-800 dark:border-fv-neutral-700 dark:text-fv-neutral-400 dark:hover:bg-fv-neutral-700 dark:hover:text-white"
|
|
224
|
-
:to="
|
|
225
|
-
currentUrl +
|
|
226
|
-
items.page_max +
|
|
227
|
-
(props.hash != '' ? `#${props.hash}` : '')
|
|
228
|
-
"
|
|
225
|
+
:to="page(items.page_max)"
|
|
229
226
|
>
|
|
230
227
|
{{ items.page_max }}
|
|
231
228
|
</router-link>
|