feat(page): 新增 @jump 回调函数

This commit is contained in:
就眠仪式 2021-10-11 00:11:54 +08:00
parent 147a55e038
commit 9f18058e9e
3 changed files with 30 additions and 1 deletions

View File

@ -81,3 +81,28 @@ export default {
</script> </script>
::: :::
::: demo
<template>
<lay-page limit=20 total=100 @jump="jump" showPage></lay-page>
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
const jump = function({ current }) {
console.log("当前页:" + current)
}
return {
jump
}
}
}
</script>
:::

View File

@ -269,7 +269,7 @@ export default {
{ {
id: 31, id: 31,
title: '穿梭框', title: '穿梭框',
subTitle: 'tree', subTitle: 'transfer',
path: '/zh-CN/components/transfer', path: '/zh-CN/components/transfer',
}, },
] ]

View File

@ -82,6 +82,8 @@ const totalPage = ref(Math.ceil(props.total / inlimit.value))
const currentPage: Ref<number> = ref(1) const currentPage: Ref<number> = ref(1)
const currentPageShow: Ref<number> = ref(currentPage.value) const currentPageShow: Ref<number> = ref(currentPage.value)
const emit = defineEmits(['jump'])
const prev = function () { const prev = function () {
if (currentPage.value === 1) { if (currentPage.value === 1) {
return return
@ -111,5 +113,7 @@ watch(inlimit, function () {
watch(currentPage, function () { watch(currentPage, function () {
currentPageShow.value = currentPage.value currentPageShow.value = currentPage.value
emit('jump', {current: currentPage.value})
}) })
</script> </script>