fix pagination (#11382) (#11406)

This commit is contained in:
0808bing 2023-11-20 16:22:53 +08:00 committed by GitHub
parent 6a4d740781
commit e9ffb370b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 23 deletions

View File

@ -55,6 +55,7 @@ class ListeningToQuery extends React.Component {
pageSize: 10,
currentPage: 1,
dataSource: [],
totalDataSource: [],
};
this.field = new Field(this);
this.group = getParams('listeningGroup') || '';
@ -127,8 +128,9 @@ class ListeningToQuery extends React.Component {
}
}
self.setState({
dataSource: dataSoureTmp || [],
totalDataSource: dataSoureTmp || [],
total: dataSoureTmp.length || 0,
dataSource: dataSoureTmp.slice(0, self.state.pageSize),
});
}
},
@ -141,8 +143,10 @@ class ListeningToQuery extends React.Component {
showMore() {}
changePage = value => {
const startIndex = (value - 1) * this.state.pageSize;
this.setState({
currentPage: value,
dataSource: this.state.totalDataSource.slice(startIndex, startIndex + this.state.pageSize),
});
};

View File

@ -35,7 +35,7 @@
<link rel="stylesheet" type="text/css" href="console-ui/public/css/icon.css">
<link rel="stylesheet" type="text/css" href="console-ui/public/css/font-awesome.css">
<!-- 第三方css结束 -->
<link href="./css/main.css?c8c3e819b0fa18cbca1c" rel="stylesheet"></head>
<link href="./css/main.css?ee1639a1849b1f838f1a" rel="stylesheet"></head>
<body>
<div id="root" style="overflow:hidden"></div>
@ -56,6 +56,6 @@
<script src="console-ui/public/js/merge.js"></script>
<script src="console-ui/public/js/loader.js"></script>
<!-- 第三方js结束 -->
<script type="text/javascript" src="./js/main.js?c8c3e819b0fa18cbca1c"></script></body>
<script type="text/javascript" src="./js/main.js?ee1639a1849b1f838f1a"></script></body>
</html>

File diff suppressed because one or more lines are too long