web123456

Vue3+ElementPlus Table paging component packaging

<template> <!-- Pagination --> <el-pagination background @size-change="handleSizeChange" @current-change="handlePageChange" :page-sizes="[10, 30, 100]" :page-size="pagesize" :layout="layout" :total="total"> </el-pagination> </template> <script> export default { name:'Pagination', props: { pagesize: [Number, String],//How many items per page Currentpage:[Number, String],//Current page Total:[Number, String],//Total page count options:[Object], // The page changes and assigns values ​​to options render:[Function], // Redirect triggered request layout:{ type: String, default: 'total, sizes, prev, pager, next, jumper' } }, setup(props,context) {// Pagination navigation const handlePageChange= (val)=>{ = val; (); }//Switch the number of pages const handleSizeChange= (val) =>{ = val; (); } return{ handlePageChange, handleSizeChange } } } </script> <style> </style>