增加分页器删除最后一条数据时,currentPage没有减一,页面列表为空的问题、解决启动弹出两个页面
This commit is contained in:
parent
65d8c451e8
commit
dceb2119eb
|
@ -5,7 +5,7 @@
|
|||
"author": "Pan <panfree23@gmail.com>",
|
||||
"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",
|
||||
|
|
|
@ -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 })
|
||||
|
|
|
@ -31,7 +31,6 @@ module.exports = {
|
|||
productionSourceMap: false,
|
||||
devServer: {
|
||||
port: port,
|
||||
open: true,
|
||||
overlay: {
|
||||
warnings: false,
|
||||
errors: true
|
||||
|
|
Loading…
Reference in New Issue