mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-29 19:30:37 +01:00
fix(Table): data outdated when rows change (#2600)
This commit is contained in:
@@ -105,6 +105,7 @@
|
|||||||
|
|
||||||
<slot
|
<slot
|
||||||
v-else
|
v-else
|
||||||
|
:key="retriggerSlot"
|
||||||
:name="`${column.key}-data`"
|
:name="`${column.key}-data`"
|
||||||
:column="column"
|
:column="column"
|
||||||
:row="row"
|
:row="row"
|
||||||
@@ -132,7 +133,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { computed, defineComponent, toRaw, toRef } from 'vue'
|
import { computed, defineComponent, ref, toRaw, toRef, watch } from 'vue'
|
||||||
import type { PropType, AriaAttributes } from 'vue'
|
import type { PropType, AriaAttributes } from 'vue'
|
||||||
import { upperFirst } from 'scule'
|
import { upperFirst } from 'scule'
|
||||||
import { defu } from 'defu'
|
import { defu } from 'defu'
|
||||||
@@ -284,6 +285,8 @@ export default defineComponent({
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const retriggerSlot = ref(null)
|
||||||
|
|
||||||
const savedSort = { column: sort.value.column, direction: null }
|
const savedSort = { column: sort.value.column, direction: null }
|
||||||
|
|
||||||
const rows = computed(() => {
|
const rows = computed(() => {
|
||||||
@@ -466,6 +469,12 @@ export default defineComponent({
|
|||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
watch(rows, () => {
|
||||||
|
retriggerSlot.value = new Date()
|
||||||
|
}, {
|
||||||
|
deep: true
|
||||||
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
// eslint-disable-next-line vue/no-dupe-keys
|
// eslint-disable-next-line vue/no-dupe-keys
|
||||||
ui,
|
ui,
|
||||||
@@ -493,7 +502,8 @@ export default defineComponent({
|
|||||||
toggleOpened,
|
toggleOpened,
|
||||||
getAriaSort,
|
getAriaSort,
|
||||||
isExpanded,
|
isExpanded,
|
||||||
shouldRenderColumnInFirstPlace
|
shouldRenderColumnInFirstPlace,
|
||||||
|
retriggerSlot
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user