Otsuka-APP/components/MB/MBPagination.vue

51 lines
1.1 KiB
Vue

<template>
<uni-pagination
v-model:current="currentPage"
v-model:pageSize="pageSize"
:total="total"
next-text="后一页"
prev-text="前一页"
@change="handleChange"
/>
</template>
<script setup>
import UniPagination from "../../uni_modules/uni-pagination/components/uni-pagination/uni-pagination.vue";
import {computed, defineEmits, defineOptions, defineProps} from 'vue'
defineOptions({
name: 'MBPagination',
inheritAttrs: false
})
const emit = defineEmits()
const props = defineProps(['total', 'pagination', 'page', 'limit'])
const currentPage = computed({
get() {
return props.page
},
set(val) {
emit('update:page', val)
}
})
const pageSize = computed({
get() {
return props.limit
},
set(val) {
emit('update:pageSize', val)
}
})
const handleChange = ({type, current}) => {
currentPage.value = current
console.log(type, current, pageSize.value)
emit('pagination', {
page: current,
limit: pageSize.value
})
}
</script>