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