This commit is contained in:
那些花儿
2025-09-06 16:42:59 +08:00
parent c973ded5c5
commit 0256ec50a9
3 changed files with 30 additions and 37 deletions
@@ -7,7 +7,7 @@
v-model="tableLoading"
:finished="tableFinished"
finished-text=""
@load="pageData">
@load="onLoad">
<div class="table-list-container">
<div v-for="(row, index) in tableData" :key="index" class="table-list-item">
<slot name="header" :index="index" :row="row">
@@ -59,11 +59,12 @@ module.exports = {
},
watch: {
page_form: {
handler(val) {
this.localPageForm = {...val}
handler(newVal, oldVal) {
debugger
this.localPageForm = {...newVal}
},
deep: true,
immediate: false
immediate: true
}
},
data() {
@@ -76,9 +77,16 @@ module.exports = {
}
},
methods: {
onLoad(){
if (this.tableFinished) return
this.localPageForm.pageNumber++
this.$emit('update:page_form', {...this.localPageForm});
this.pageData()
},
pageData() {
this.tableLoading = true
// this.localPageForm = {...this.page_form}
const loading = createListLoading()
this.$axios.post(this.api, this.json ? ({pageForm: JSON.stringify(this.localPageForm)}) : this.localPageForm).then((res) => {
if (res.code === 0) {
@@ -87,20 +95,21 @@ module.exports = {
if (this.tableData.length >= this.localPageForm.totalCount) {
this.tableFinished = true
}
this.localPageForm.pageNumber++
// 触发事件更新父组件的pageForm
this.$emit('update:page_form', {...this.localPageForm});
}
}).finally(() => {
loading.close()
console.log(this.tableLoading)
this.tableLoading = false
console.log(this.tableLoading)
this.tableRefreshing = false
})
},
doSearch() {
this.tableFinished = false;
this.tableData = [];
this.pageData();
this.tableFinished = false
this.tableData = []
this.localPageForm.pageNumber = 1
this.$emit('update:page_form', {...this.localPageForm});
this.pageData()
},
onRefresh() {
this.localPageForm.pageNumber = 1