分页

上级 ee178ad2
......@@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --port 3001",
"serve": "vue-cli-service serve --port 3001",
"build": "vue-cli-service build"
},
"dependencies": {
......
......@@ -54,7 +54,7 @@ export default {
// 用户列表数据
userlist: [],
loading: false,
currentPage: 1,
currentPage: localStorage.getItem("lastPage") || 1,
pageSize: 5,
total: 0,
};
......@@ -64,7 +64,15 @@ export default {
// 调用请求数据的方法
this.initCartList();
},
mounted() {
console.log(this.$refs)
var lastPage = localStorage.getItem("lastPage");
if (lastPage) {
this.$nextTick(() => {
this.$refs.pagination.setCurrentPage(Number(lastPage));
});
}
},
methods: {
refreshPage() {
location.reload();
......@@ -87,6 +95,7 @@ export default {
if (res.code === 200) {
this.userlist = res.result.records;
this.total = res.result.total;
localStorage.setItem("lastPage", this.currentPage);
}
this.loading = false;
},
......
......@@ -36,7 +36,6 @@
<script>
// 导入 axios 请求库
import axios from "axios";
import ClipboardJS from "clipboard";
export default {
name: "MyChatDetail",
props: ["id"],
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册