🐛(component): 修复 total 为 0 时禁用下一页操作
This commit is contained in:
parent
fccdf27ae2
commit
df8b318bdc
@ -84,7 +84,7 @@ const prev = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const next = () => {
|
const next = () => {
|
||||||
if (currentPage.value === maxPage.value) {
|
if (currentPage.value === maxPage.value || maxPage.value === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
currentPage.value++;
|
currentPage.value++;
|
||||||
@ -133,6 +133,7 @@ watch(
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
{{ maxPage }}
|
||||||
<div class="layui-laypage layui-laypage-default">
|
<div class="layui-laypage layui-laypage-default">
|
||||||
<span v-if="showCount" class="layui-laypage-count"
|
<span v-if="showCount" class="layui-laypage-count"
|
||||||
>共 {{ total }} 条 {{ maxPage }} 页</span
|
>共 {{ total }} 条 {{ maxPage }} 页</span
|
||||||
@ -171,8 +172,8 @@ watch(
|
|||||||
href="javascript:;"
|
href="javascript:;"
|
||||||
class="layui-laypage-next"
|
class="layui-laypage-next"
|
||||||
:class="[
|
:class="[
|
||||||
currentPage === maxPage ? 'layui-disabled' : '',
|
currentPage === maxPage || maxPage === 0 ? 'layui-disabled' : '',
|
||||||
theme && currentPage !== maxPage ? 'layui-laypage-a-' + theme : '',
|
theme && (currentPage !== maxPage && maxPage !== 0) ? 'layui-laypage-a-' + theme : '',
|
||||||
]"
|
]"
|
||||||
@click="next()"
|
@click="next()"
|
||||||
>
|
>
|
||||||
|
@ -143,7 +143,7 @@ export default {
|
|||||||
setup() {
|
setup() {
|
||||||
|
|
||||||
const limit4 = ref(20)
|
const limit4 = ref(20)
|
||||||
const total4 = ref(100)
|
const total4 = ref(0)
|
||||||
const change4 = ({ current, limit }) => {
|
const change4 = ({ current, limit }) => {
|
||||||
layer.msg("current:" + current + " limit:" + limit);
|
layer.msg("current:" + current + " limit:" + limit);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user