|
@@ -1,37 +1,44 @@
|
|
|
<template>
|
|
|
- <el-row class="pages">
|
|
|
- <el-pagination background layout="prev, pager, next" :total="total" :page-size="limit" @change="toChange" />
|
|
|
- </el-row>
|
|
|
+ <el-row class="pages">
|
|
|
+ <el-pagination
|
|
|
+ background
|
|
|
+ layout="prev, pager, next"
|
|
|
+ :total="total"
|
|
|
+ :page-size="limit"
|
|
|
+ @change="toChange"
|
|
|
+ v-model:current-page="cp"
|
|
|
+ />
|
|
|
+ </el-row>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-
|
|
|
-import { defineEmits } from 'vue'
|
|
|
-
|
|
|
+import { defineEmits, ref } from 'vue'
|
|
|
+const cp = ref(1)
|
|
|
const total = defineModel('total', {
|
|
|
- type: Number,
|
|
|
- default: 0
|
|
|
+ type: Number,
|
|
|
+ default: 0,
|
|
|
})
|
|
|
|
|
|
const limit = defineModel('limit', {
|
|
|
- type: Number,
|
|
|
- default: 10
|
|
|
+ type: Number,
|
|
|
+ default: 10,
|
|
|
})
|
|
|
|
|
|
-
|
|
|
const emit = defineEmits(['search'])
|
|
|
|
|
|
-
|
|
|
/* 点击 */
|
|
|
const toChange = (currentPage: number) => {
|
|
|
- emit('search', { skip: (currentPage - 1) * limit.value })
|
|
|
+ emit('search', { skip: (currentPage - 1) * limit.value })
|
|
|
}
|
|
|
-
|
|
|
+const reset = () => {
|
|
|
+ cp.value = 1
|
|
|
+}
|
|
|
+defineExpose({ reset })
|
|
|
</script>
|
|
|
<style scoped lang="scss">
|
|
|
.pages {
|
|
|
- display: flex;
|
|
|
- justify-content: center;
|
|
|
- margin: 30px 0 0 0;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ margin: 30px 0 0 0;
|
|
|
}
|
|
|
</style>
|