fix(form): table分页lastData初始化异常

This commit is contained in:
roymondchen 2023-10-23 11:14:36 +08:00
parent 1c516bb24b
commit bd9686dbd8

View File

@ -249,7 +249,7 @@ const modelName = computed(() => props.name || props.config.name || '');
const data = computed(() =>
props.config.pagination
? props.model[modelName.value].filter(
? (props.model[modelName.value] || []).filter(
(item: any, index: number) =>
index >= pagecontext.value * pagesize.value && index + 1 <= (pagecontext.value + 1) * pagesize.value,
)
@ -258,11 +258,11 @@ const data = computed(() =>
const lastData = computed(() =>
props.config.pagination
? props.lastValues[modelName.value].filter(
? (props.lastValues[modelName.value] || []).filter(
(item: any, index: number) =>
index >= pagecontext.value * pagesize.value && index + 1 <= (pagecontext.value + 1) * pagesize.value,
)
: props.lastValues[modelName.value] || {},
: props.lastValues[modelName.value] || [],
);
const sortChange = ({ prop, order }: SortProp) => {