[修复]分页组件中每页数量变化时触发limit事件

This commit is contained in:
castle
2021-12-27 16:31:40 +08:00
parent e803274ba6
commit 8fd74db35d
2 changed files with 37 additions and 3 deletions

View File

@@ -80,7 +80,7 @@ const props = withDefaults(
}
);
const pages = props.pages / 2
const inlimit = ref(props.limit);
const inlimit = computed({ get() { return props.limit }, set(v: number) { emit('limit', v) } })
const maxPage = ref(Math.ceil(props.total / props.limit));
const totalPage = computed(() => {
let r: number[] = [], end = maxPage.value
@@ -99,7 +99,7 @@ const totalPage = computed(() => {
const currentPage: Ref<number> = ref(1);
const currentPageShow: Ref<number> = ref(currentPage.value);
const emit = defineEmits(["jump"]);
const emit = defineEmits(["jump", "limit"]);
const prev = function () {
if (currentPage.value === 1) {