查看我的App.js组件中的以下代码:
const App = () => {
const [workstations, setWorkstations] = useState([]);
let [page, setPage] = useState(1);
const PER_PAGE = 1;
useEffect(() => {
loadWorkstations();
}, []);
const loadWorkstations = async () => {
const request = await getWorkstations();
const result = request.data;
setWorkstations(result);
};
const count = Math.ceil(workstations.length / PER_PAGE);
const _DATA = usePagination(workstations, PER_PAGE);
const handleChange = (e, p) => {
setPage(p);
_DATA.jump(p);
};
return (
<Pagination
count={count}
size="large"
page={page}
variant="outlined"
color="primary"
onChange={handleChange}
/>
);
};
现在我从这个实现中得到的结果是这样的:
但我所寻找的应该是这样的:
我的意思是,我不想看到我的所有网页上的用户界面,并显示其余的“...”
注:使用@material-ui/lab进行即时消息传递
2条答案
按热度按时间deyfvvtc1#
您的代码看起来不错,但是,您需要从@mui导入Pagination以实现所需的行为
z4iuyo4d2#