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