invalid w
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
32 additions and
7 deletions
-
src/components/CardList/src/CardList.vue
-
src/components/Form/src/hooks/useFormEvents.ts
-
src/views/form-design/components/VFormDesign/modules/FormComponentPanel.vue
|
|
|
@ -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)); |
|
|
|
// 组件接收参数 |
|
|
|
|
|
|
|
@ -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); |
|
|
|
} |
|
|
|
|
|
|
|
@ -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; |
|
|
|
|