@fy-/fws-vue 2.1.23 → 2.1.25
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 +26 -22
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ import { getURL, hasFW } from '@fy-/fws-js'
|
|
|
8
8
|
import { ChevronLeftIcon, ChevronRightIcon } from '@heroicons/vue/24/solid'
|
|
9
9
|
import { useServerHead } from '@unhead/vue'
|
|
10
10
|
import {
|
|
11
|
+
computed,
|
|
11
12
|
onMounted,
|
|
12
13
|
onUnmounted,
|
|
13
14
|
ref,
|
|
@@ -77,18 +78,17 @@ function page(page: number): RouteLocationRaw {
|
|
|
77
78
|
function checkPageNumber(page: number = 1) {
|
|
78
79
|
prevNextSeo.value.next = undefined
|
|
79
80
|
prevNextSeo.value.prev = undefined
|
|
80
|
-
|
|
81
|
-
const pageMinus = page - 1
|
|
81
|
+
|
|
82
82
|
if (hasFW()) {
|
|
83
83
|
const url = getURL()
|
|
84
|
-
if (
|
|
84
|
+
if (page + 1 <= props.items.page_max && url) {
|
|
85
85
|
prevNextSeo.value.next
|
|
86
|
-
= `${url.Scheme}://${url.Host}${
|
|
86
|
+
= `${url.Scheme}://${url.Host}${url.Path}?page=${page + 1}${
|
|
87
87
|
props.hash !== '' ? `#${props.hash}` : ''}`
|
|
88
88
|
}
|
|
89
|
-
if (
|
|
89
|
+
if (page - 1 >= 1 && url) {
|
|
90
90
|
prevNextSeo.value.prev
|
|
91
|
-
= `${url.Scheme}://${url.Host}${
|
|
91
|
+
= `${url.Scheme}://${url.Host}${url.Path}?page=${page - 1}${
|
|
92
92
|
props.hash !== '' ? `#${props.hash}` : ''}`
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -109,24 +109,28 @@ onUnmounted(() => {
|
|
|
109
109
|
})
|
|
110
110
|
|
|
111
111
|
checkPageNumber(props.items.page_no)
|
|
112
|
-
const result: any = []
|
|
113
|
-
if (prevNextSeo.value.next) {
|
|
114
|
-
result.push({
|
|
115
|
-
href: prevNextSeo.value.next,
|
|
116
|
-
rel: 'next',
|
|
117
|
-
key: 'next',
|
|
118
|
-
})
|
|
119
|
-
}
|
|
120
|
-
if (prevNextSeo.value.prev) {
|
|
121
|
-
result.push({
|
|
122
|
-
href: prevNextSeo.value.prev,
|
|
123
|
-
rel: 'prev',
|
|
124
|
-
key: 'prev',
|
|
125
|
-
})
|
|
126
|
-
}
|
|
127
112
|
|
|
128
113
|
useServerHead({
|
|
129
|
-
link:
|
|
114
|
+
link: computed(() => {
|
|
115
|
+
const result: any = []
|
|
116
|
+
checkPageNumber(props.items.page_no)
|
|
117
|
+
if (prevNextSeo.value.next) {
|
|
118
|
+
result.push({
|
|
119
|
+
href: prevNextSeo.value.next,
|
|
120
|
+
rel: 'next',
|
|
121
|
+
key: 'paging-next',
|
|
122
|
+
})
|
|
123
|
+
}
|
|
124
|
+
if (prevNextSeo.value.prev) {
|
|
125
|
+
result.push({
|
|
126
|
+
href: prevNextSeo.value.prev,
|
|
127
|
+
rel: 'prev',
|
|
128
|
+
key: 'paging-prev',
|
|
129
|
+
})
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return result
|
|
133
|
+
}),
|
|
130
134
|
})
|
|
131
135
|
</script>
|
|
132
136
|
|