<template>
<div class='mypage'>
<div class="demo-pagination-block">
<el-pagination
v-model:currentPage="pagenum"
v-model:page-size="pagesize"
:page-sizes="[1, 2, 3, 4]"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="chengpagesize"
@current-change="chengpagenum"
>
</el-pagination>
</div>
</div>
</template>
<script setup>
import { ref } from "vue";
// 接收父组件的页码 size
const props = defineProps(["pagesize", "pagenum", "total"]);
// 子传父
const emit = defineEmits(["chengpagesize", "chengpagenum"]);
// size改变的时候
const chengpagesize = val => {
emit("chengpagesize", val);
};
const chen
vue3 的组件传值
于 2022-03-01 16:34:18 首次发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)