From 076e17349e4744c68aaff3529842ac243722b731 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E8=8B=B1=E6=9D=B0?= <327782001@qq.com> Date: Wed, 12 Jul 2023 09:17:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/components/menus/MyChat.vue | 15 ++++++++++++--- src/components/user/MyChatDetail.vue | 3 +-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 3d58976..1069132 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/components/menus/MyChat.vue b/src/components/menus/MyChat.vue index ae00bd5..bff5b50 100644 --- a/src/components/menus/MyChat.vue +++ b/src/components/menus/MyChat.vue @@ -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; }, @@ -118,4 +127,4 @@ export default { margin-right: 15px; font-size: 20px; } - + \ No newline at end of file diff --git a/src/components/user/MyChatDetail.vue b/src/components/user/MyChatDetail.vue index 6d269f1..ba95b7d 100644 --- a/src/components/user/MyChatDetail.vue +++ b/src/components/user/MyChatDetail.vue @@ -36,7 +36,6 @@