mirror of https://github.com/jeecgboot/jeecg-boot
【#8695】修复JVxeTable卡顿问题
parent
1b8a31f0d3
commit
7af8346b79
|
@ -1,5 +1,5 @@
|
||||||
import { unref, computed, ref, watch, nextTick } from 'vue';
|
import { unref, computed, ref, watch, nextTick } from 'vue';
|
||||||
import { merge } from 'lodash-es';
|
import { merge, debounce } from 'lodash-es';
|
||||||
import { isArray } from '/@/utils/is';
|
import { isArray } from '/@/utils/is';
|
||||||
import { useAttrs } from '/@/hooks/core/useAttrs';
|
import { useAttrs } from '/@/hooks/core/useAttrs';
|
||||||
import { useKeyboardEdit } from '../hooks/useKeyboardEdit';
|
import { useKeyboardEdit } from '../hooks/useKeyboardEdit';
|
||||||
|
@ -41,17 +41,8 @@ export function useFinallyProps(props: JVxeTableProps, data: JVxeDataProps, meth
|
||||||
return events;
|
return events;
|
||||||
});
|
});
|
||||||
|
|
||||||
// update-begin--author:sunjianlei---date:20250804---for:【issues/8593】修复列改变后内容不刷新
|
|
||||||
const vxeColumnsRef = ref([])
|
|
||||||
watch(data.vxeColumns, async () => {
|
|
||||||
vxeColumnsRef.value = []
|
|
||||||
await nextTick()
|
|
||||||
vxeColumnsRef.value = data.vxeColumns.value
|
|
||||||
}, {immediate: true})
|
|
||||||
// update-end----author:sunjianlei---date:20250804---for:【issues/8593】修复列改变后内容不刷新
|
|
||||||
|
|
||||||
// vxe 最终 props
|
// vxe 最终 props
|
||||||
const vxeProps = computed(() => {
|
const vxePropsMerge = computed(() => {
|
||||||
// update-begin--author:liaozhiyang---date:20240417---for:【QQYUN-8785】online表单列位置的id未做限制,拖动其他列到id列上面,同步数据库时报错
|
// update-begin--author:liaozhiyang---date:20240417---for:【QQYUN-8785】online表单列位置的id未做限制,拖动其他列到id列上面,同步数据库时报错
|
||||||
let rowClass = {};
|
let rowClass = {};
|
||||||
if (props.dragSort) {
|
if (props.dragSort) {
|
||||||
|
@ -88,7 +79,6 @@ export function useFinallyProps(props: JVxeTableProps, data: JVxeDataProps, meth
|
||||||
loading: false,
|
loading: false,
|
||||||
disabled: props.disabled,
|
disabled: props.disabled,
|
||||||
// columns: unref(data.vxeColumns),
|
// columns: unref(data.vxeColumns),
|
||||||
columns: vxeColumnsRef.value,
|
|
||||||
editRules: unref(vxeEditRules),
|
editRules: unref(vxeEditRules),
|
||||||
height: props.height === 'auto' ? null : props.height,
|
height: props.height === 'auto' ? null : props.height,
|
||||||
maxHeight: props.maxHeight,
|
maxHeight: props.maxHeight,
|
||||||
|
@ -125,6 +115,25 @@ export function useFinallyProps(props: JVxeTableProps, data: JVxeDataProps, meth
|
||||||
unref(keyboardEditConfig)
|
unref(keyboardEditConfig)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// update-begin--author:sunjianlei---date:20250804---for:【issues/8593】修复列改变后内容不刷新
|
||||||
|
const vxeColumnsRef = ref([])
|
||||||
|
const watchColumnsDebounce = debounce(async () => {
|
||||||
|
vxeColumnsRef.value = []
|
||||||
|
await nextTick()
|
||||||
|
vxeColumnsRef.value = data.vxeColumns!.value
|
||||||
|
}, 50)
|
||||||
|
watch(data.vxeColumns!, watchColumnsDebounce, {immediate: true})
|
||||||
|
// update-end----author:sunjianlei---date:20250804---for:【issues/8593】修复列改变后内容不刷新
|
||||||
|
|
||||||
|
const vxeProps = computed(() => {
|
||||||
|
return {
|
||||||
|
...unref(vxePropsMerge),
|
||||||
|
// 【issue/8695】单独抽出 columns,防止性能问题
|
||||||
|
columns: unref(vxeColumnsRef),
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
vxeProps,
|
vxeProps,
|
||||||
prefixCls: data.prefixCls,
|
prefixCls: data.prefixCls,
|
||||||
|
|
Loading…
Reference in New Issue