修改页数到达临界值时样式,增加提示
This commit is contained in:
parent
e97a3df69d
commit
7f33b3798b
|
|
@ -29,6 +29,7 @@
|
|||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
const props = defineProps({
|
||||
size: {
|
||||
type: Number,
|
||||
|
|
@ -51,7 +52,7 @@
|
|||
default: 0
|
||||
}
|
||||
})
|
||||
const emits = defineEmits(['change'])
|
||||
const emits = defineEmits(['change','update:page'])
|
||||
|
||||
let currentPage = ref(props.page === 0 ? 1 : props.page)
|
||||
|
||||
|
|
@ -81,16 +82,17 @@
|
|||
function btnClick(isAdd) {
|
||||
let newPage = currentPage.value * 1 + (isAdd == 'add' ? 1 : -1)
|
||||
if (newPage <= 0) {
|
||||
return
|
||||
return infoBox.showToast('已经是第一页了')
|
||||
}
|
||||
if (newPage > maxPage.value) {
|
||||
return
|
||||
return infoBox.showToast('没有更多页了')
|
||||
}
|
||||
setCurrentPage(newPage)
|
||||
}
|
||||
|
||||
watch(() => currentPage.value, (newval) => {
|
||||
emits('change', newval)
|
||||
emits('update:page', newval)
|
||||
defaultPaageIndex.value = newval - 1
|
||||
})
|
||||
</script>
|
||||
|
|
@ -122,8 +124,8 @@
|
|||
|
||||
.prve,.next {
|
||||
&.disabled {
|
||||
background-color: #ccc;
|
||||
border-color: #ccc;
|
||||
// background-color: #ccc;
|
||||
// border-color: #ccc;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue