mirror of
https://github.com/element-plus/element-plus.git
synced 2024-11-27 02:01:15 +08:00
fix(components): [el-table] defaultSort not working (#6322)
* fix(components): [el-table] defaultSort not working * fix: unit test * chore: improve code
This commit is contained in:
parent
166c5944d0
commit
43ee78563b
@ -749,9 +749,9 @@ describe('Table.vue', () => {
|
||||
)
|
||||
expect(lastCells.map((node) => node.text())).toEqual([
|
||||
'80',
|
||||
'92',
|
||||
'92',
|
||||
'95',
|
||||
'92',
|
||||
'92',
|
||||
'100',
|
||||
])
|
||||
await doubleWait()
|
||||
|
@ -63,12 +63,12 @@ export default defineComponent({
|
||||
const ns = useNamespace('table')
|
||||
const filterPanels = ref({})
|
||||
const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent!)
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
const { prop, order } = props.defaultSort
|
||||
const init = true
|
||||
parent?.store.commit('sort', { prop, order, init })
|
||||
})
|
||||
onMounted(async () => {
|
||||
// Need double await, because udpateColumns is executed after nextTick for now
|
||||
await nextTick()
|
||||
await nextTick()
|
||||
const { prop, order } = props.defaultSort
|
||||
parent?.store.commit('sort', { prop, order, init: true })
|
||||
})
|
||||
const {
|
||||
handleHeaderClick,
|
||||
|
Loading…
Reference in New Issue
Block a user