🐛(page): 修复起始页计算逻辑
This commit is contained in:
parent
2a8000758f
commit
e4e6bd0f84
@ -58,12 +58,14 @@ watch(
|
|||||||
const totalPage = computed(() => {
|
const totalPage = computed(() => {
|
||||||
maxPage.value = Math.ceil(props.total / inlimit.value);
|
maxPage.value = Math.ceil(props.total / inlimit.value);
|
||||||
let r: number[] = [];
|
let r: number[] = [];
|
||||||
|
// 计算 star 页
|
||||||
let start =
|
let start =
|
||||||
maxPage.value <= props.pages
|
maxPage.value <= props.pages
|
||||||
? 1
|
? 1
|
||||||
: currentPage.value > pages
|
: currentPage.value > pages
|
||||||
? currentPage.value - pages
|
? maxPage.value - currentPage.value + 1 < pages ? currentPage.value - (pages + (pages - (maxPage.value - currentPage.value + 1))) : currentPage.value - pages
|
||||||
: 1;
|
: 1;
|
||||||
|
|
||||||
for (let i = start; ; i++) {
|
for (let i = start; ; i++) {
|
||||||
if (r.length >= props.pages || i > maxPage.value) {
|
if (r.length >= props.pages || i > maxPage.value) {
|
||||||
break;
|
break;
|
||||||
|
@ -111,7 +111,7 @@ export default {
|
|||||||
setup() {
|
setup() {
|
||||||
|
|
||||||
const limit3 = ref(5)
|
const limit3 = ref(5)
|
||||||
const total3 = ref(100)
|
const total3 = ref(125)
|
||||||
const limits3 = ref([5, 10, 50, 100, 200])
|
const limits3 = ref([5, 10, 50, 100, 200])
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -181,7 +181,7 @@ export default {
|
|||||||
|
|
||||||
const limit5 = ref(10)
|
const limit5 = ref(10)
|
||||||
const total5 = ref(99)
|
const total5 = ref(99)
|
||||||
const pages5 = ref(6);
|
const pages5 = ref(7);
|
||||||
const current5 = ref(1);
|
const current5 = ref(1);
|
||||||
const changeCurrent5 = () => {
|
const changeCurrent5 = () => {
|
||||||
current5.value = 2;
|
current5.value = 2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user