|
@@ -16,6 +16,11 @@ export default (target, hasPagination = true) => ({
|
|
|
total: 0
|
|
|
}),
|
|
|
methods: {
|
|
|
+ afterLoadList () {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$refs.table && this.$refs.table.doLayout()
|
|
|
+ }, 0)
|
|
|
+ },
|
|
|
loadList () {
|
|
|
let query = Object.assign({}, this.query)
|
|
|
if (hasPagination) {
|
|
@@ -24,15 +29,13 @@ export default (target, hasPagination = true) => ({
|
|
|
.then(data => {
|
|
|
this.total = data.count
|
|
|
this.data = Object.freeze(bindPrototype(data.list, target))
|
|
|
- setTimeout(() => {
|
|
|
- this.$refs.table && this.$refs.table.doLayout()
|
|
|
- }, 0)
|
|
|
+ this.afterLoadList()
|
|
|
}).catch(console.error).finally(() => {})
|
|
|
} else {
|
|
|
this.$$request(target.$$api.getList, this.query).then(list => {
|
|
|
this.total = list.length
|
|
|
this.data = Object.freeze(bindPrototype(Object.freeze(list), target))
|
|
|
- this.$refs.table && this.$refs.table.doLayout()
|
|
|
+ this.afterLoadList()
|
|
|
}).catch(console.error).finally(() => {})
|
|
|
}
|
|
|
},
|