* fix: #2767

* fix: #2884

* fix: #2868
This commit is contained in:
invalid w 2023-08-13 09:14:04 +08:00 committed by GitHub
parent 44f2b1c644
commit 5425dc241f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 7 deletions

View File

@ -61,7 +61,7 @@
<CardMeta>
<template #title>
<TypographyText :content="item.name" :ellipsis="{ tooltip: item.address }" />
<TypographyParagraph :content="item.name" :ellipsis="{ tooltip: item.address }" />
</template>
<template #avatar>
<Avatar :src="item.avatar" />
@ -93,7 +93,7 @@
const ListItem = List.Item;
const CardMeta = Card.Meta;
const TypographyText = Typography.Text;
const TypographyParagraph = Typography.Paragraph;
// slider
const sliderProp = computed(() => useSlider(4));
//

View File

@ -94,9 +94,7 @@ export function useFormEvents({
formModel[field] = defaultValueObj![field];
});
}
const isInput = schema?.component && defaultValueComponents.includes(schema.component);
const defaultValue = cloneDeep(defaultValueRef.value[key]);
formModel[key] = isInput ? defaultValue || '' : defaultValue;
formModel[key] = getDefaultValue(schema, defaultValueRef, key);
});
nextTick(() => clearValidate());
@ -407,3 +405,29 @@ export function useFormEvents({
scrollToField,
};
}
function getDefaultValue(
schema: FormSchema | undefined,
defaultValueRef: UseFormActionContext['defaultValueRef'],
key: string,
) {
let defaultValue = cloneDeep(defaultValueRef.value[key]);
const isInput = checkIsInput(schema);
if (isInput) {
return defaultValue || '';
}
if (!defaultValue && schema && checkIsRangeSlider(schema)) {
defaultValue = [0, 0];
}
return defaultValue;
}
function checkIsRangeSlider(schema: FormSchema) {
if (schema.component === 'Slider' && schema.componentProps && schema.componentProps.range) {
return true;
}
}
function checkIsInput(schema?: FormSchema) {
return schema?.component && defaultValueComponents.includes(schema.component);
}

View File

@ -131,15 +131,16 @@
}
.draggable-box {
height: calc(100vh - 200px);
// width: 100%;
overflow: auto;
.drag-move {
min-height: 62px;
cursor: move;
}
.list-main {
height: 100%;
overflow: auto;
//
.list-enter-active {
transition: all 0.5s;