增加分页器删除最后一条数据时,currentPage没有减一,页面列表为空的问题、解决启动弹出两个页面
This commit is contained in:
parent
65d8c451e8
commit
dceb2119eb
|
@ -5,7 +5,7 @@
|
||||||
"author": "Pan <panfree23@gmail.com>",
|
"author": "Pan <panfree23@gmail.com>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vue-cli-service serve",
|
"dev": "vue-cli-service serve --open",
|
||||||
"build:prod": "vue-cli-service build",
|
"build:prod": "vue-cli-service build",
|
||||||
"build:stage": "vue-cli-service build --mode staging",
|
"build:stage": "vue-cli-service build --mode staging",
|
||||||
"preview": "node build/index.js --preview",
|
"preview": "node build/index.js --preview",
|
||||||
|
|
|
@ -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: {
|
methods: {
|
||||||
handleSizeChange(val) {
|
handleSizeChange(val) {
|
||||||
this.$emit('pagination', { page: this.currentPage, limit: val })
|
this.$emit('pagination', { page: this.currentPage, limit: val })
|
||||||
|
|
|
@ -31,7 +31,6 @@ module.exports = {
|
||||||
productionSourceMap: false,
|
productionSourceMap: false,
|
||||||
devServer: {
|
devServer: {
|
||||||
port: port,
|
port: port,
|
||||||
open: true,
|
|
||||||
overlay: {
|
overlay: {
|
||||||
warnings: false,
|
warnings: false,
|
||||||
errors: true
|
errors: true
|
||||||
|
|
Loading…
Reference in New Issue