分页

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