修复产量报表分页翻页无效:改用watch监听page变化自动加载数据

Element Plus的@current-change事件中v-model更新时序导致
loadData()读到旧的page值,使翻页后数据不变化。
改为watch([page.page, page.pageSize])监听,数据变化后自动重载。
main
haoliang 1 month ago
parent 87d7dfeee1
commit e6b941f9e1

@ -99,7 +99,7 @@
</div>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted, toRefs } from 'vue'
import { ref, reactive, onMounted, watch } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import request from '@/utils/request'
import type { ProductionRecord, ProductionDashboardSummary } from '@/types'
@ -254,4 +254,9 @@ function handleAdjust(row: ProductionRecord){
}
onMounted(init)
//
watch([() => page.page, () => page.pageSize], () => {
loadData()
})
</script>

Loading…
Cancel
Save