From dceb2119eb780d3b294ea76fb6f87fb09f5760eb Mon Sep 17 00:00:00 2001 From: shiyanbin Date: Wed, 11 Dec 2019 17:37:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=86=E9=A1=B5=E5=99=A8?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=9C=80=E5=90=8E=E4=B8=80=E6=9D=A1=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=97=B6=EF=BC=8CcurrentPage=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=87=8F=E4=B8=80=EF=BC=8C=E9=A1=B5=E9=9D=A2=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=81=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E5=90=AF=E5=8A=A8=E5=BC=B9=E5=87=BA=E4=B8=A4=E4=B8=AA?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/components/Pagination/index.vue | 8 ++++++++ vue.config.js | 1 - 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9942fbac..ac1a7e98 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "author": "Pan ", "license": "MIT", "scripts": { - "dev": "vue-cli-service serve", + "dev": "vue-cli-service serve --open", "build:prod": "vue-cli-service build", "build:stage": "vue-cli-service build --mode staging", "preview": "node build/index.js --preview", diff --git a/src/components/Pagination/index.vue b/src/components/Pagination/index.vue index c815e132..472369be 100644 --- a/src/components/Pagination/index.vue +++ b/src/components/Pagination/index.vue @@ -73,6 +73,14 @@ export default { } } }, + watch: { + total() { + // 解决删除最后一条数据时,currentPage没有减一,页面列表为空的问题,缺点:此时列表会请求两次,暂未想到方法 + if (this.total === (this.currentPage - 1) * this.limit && this.total !== 0) { + this.$emit('pagination', { page: this.currentPage - 1, limit: this.pageSize }) + } + } + }, methods: { handleSizeChange(val) { this.$emit('pagination', { page: this.currentPage, limit: val }) diff --git a/vue.config.js b/vue.config.js index 7b8f3a5d..740ac207 100644 --- a/vue.config.js +++ b/vue.config.js @@ -31,7 +31,6 @@ module.exports = { productionSourceMap: false, devServer: { port: port, - open: true, overlay: { warnings: false, errors: true