@fy-/fws-vue 0.8.1 → 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 +14 -19
- 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
|
|
|
@@ -62,6 +62,15 @@ const prev = () => {
|
|
|
62
62
|
});
|
|
63
63
|
};
|
|
64
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
|
+
};
|
|
65
74
|
const currentUrl = computed(() => {
|
|
66
75
|
/*
|
|
67
76
|
const url = getURL();
|
|
@@ -156,9 +165,7 @@ useFyHead({
|
|
|
156
165
|
<li v-if="items.page_no - 2 > 1">
|
|
157
166
|
<router-link
|
|
158
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"
|
|
159
|
-
:to="
|
|
160
|
-
currentUrl + '1' + (props.hash != '' ? `#${props.hash}` : '')
|
|
161
|
-
"
|
|
168
|
+
:to="page(1)"
|
|
162
169
|
>
|
|
163
170
|
1
|
|
164
171
|
</router-link>
|
|
@@ -178,11 +185,7 @@ useFyHead({
|
|
|
178
185
|
>
|
|
179
186
|
<router-link
|
|
180
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"
|
|
181
|
-
:to="
|
|
182
|
-
currentUrl +
|
|
183
|
-
(items.page_no - (3 - i)) +
|
|
184
|
-
(props.hash != '' ? `#${props.hash}` : '')
|
|
185
|
-
"
|
|
188
|
+
:to="page(items.page_no - (3 - i))"
|
|
186
189
|
>
|
|
187
190
|
{{ items.page_no - (3 - i) }}
|
|
188
191
|
</router-link>
|
|
@@ -203,11 +206,7 @@ useFyHead({
|
|
|
203
206
|
>
|
|
204
207
|
<router-link
|
|
205
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"
|
|
206
|
-
:to="
|
|
207
|
-
currentUrl +
|
|
208
|
-
(items.page_no + i) +
|
|
209
|
-
(props.hash != '' ? `#${props.hash}` : '')
|
|
210
|
-
"
|
|
209
|
+
:to="page(items.page_no + i)"
|
|
211
210
|
>
|
|
212
211
|
{{ items.page_no + i }}
|
|
213
212
|
</router-link>
|
|
@@ -223,11 +222,7 @@ useFyHead({
|
|
|
223
222
|
<li v-if="items.page_no + 2 < items.page_max">
|
|
224
223
|
<router-link
|
|
225
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"
|
|
226
|
-
:to="
|
|
227
|
-
currentUrl +
|
|
228
|
-
items.page_max +
|
|
229
|
-
(props.hash != '' ? `#${props.hash}` : '')
|
|
230
|
-
"
|
|
225
|
+
:to="page(items.page_max)"
|
|
231
226
|
>
|
|
232
227
|
{{ items.page_max }}
|
|
233
228
|
</router-link>
|