fix(table): when the data changes, the layout is not updated (#1059)

Co-authored-by: winerlu <winerlu@tencent.com>
This commit is contained in:
justwiner 2020-12-31 10:43:12 +08:00 committed by GitHub
parent beb1270414
commit d54abc800a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,8 +37,10 @@ function useStore(): Store {
} }
} }
instance.store.updateAllSelected() instance.store.updateAllSelected()
instance.store.updateTableScrollY() instance.store.updateTableScrollY()
if (instance.$ready) {
instance.store.scheduleLayout()
}
}, },
insertColumn(states, column, index, parent) { insertColumn(states, column, index, parent) {
@ -150,7 +152,7 @@ function useStore(): Store {
instance.store.updateCurrentRow(row) instance.store.updateCurrentRow(row)
}, },
} }
const commit = function (name, ...args) { const commit = function(name, ...args) {
const mutations = instance.store.mutations const mutations = instance.store.mutations
if (mutations[name]) { if (mutations[name]) {
mutations[name].apply(instance, [instance.store.states].concat(args)) mutations[name].apply(instance, [instance.store.states].concat(args))
@ -158,8 +160,8 @@ function useStore(): Store {
throw new Error(`Action not found: ${name}`) throw new Error(`Action not found: ${name}`)
} }
} }
const updateTableScrollY = function () { const updateTableScrollY = function() {
nextTick(instance.layout.updateScrollY.apply(instance.layout)) nextTick(() => instance.layout.updateScrollY.apply(instance.layout))
} }
const watcher = useWatcher() const watcher = useWatcher()
return { return {