如题所述获取表格数据
getList() {
this.listLoading = true
getFactoryList(this.listQuery).then(response => {
const data = response.data.data
this.list = data.records
this.total = data.total
this.listLoading = false;
})
},
更新数据后刷新
,直接getlist再走一遍后,分页如何保留
createData() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
createFactory(this.temp).then(res => {
const message = res.data.message
this.dialogVisible = false
if (res.data.success){
this.getList()
this.$notify({
title: '成功',
message: message,
type: 'success',
duration: 5000
})
})
}
})
},
<pagination v-show="total>0" :total="total" :page.sync="listQuery.current" :limit.sync="listQuery.size" @pagination="getList" />
我给分页一开始有个默认值
listQuery: {
current: 1,
size: 20,
factoryName:"",
address:""
},
大多数网站采用的是放在 URL 里
比如你跳到第二页, 在后面加上 query
www.t.com/home?pageNum=2
在进入页面的时候 获取 query 参数, 当然如果页面内部的 pageNum 会覆盖 query 的