fix: class

This commit is contained in:
allen
2026-04-13 20:41:43 +08:00
parent 12a81a7a7d
commit f30157fa59
2 changed files with 14 additions and 12 deletions

View File

@@ -62,10 +62,10 @@ defineExpose({
<div <div
class="body-row flex items-center w-full flex-nowrap not-last-of-type:border-b" class="body-row flex items-center w-full flex-nowrap not-last-of-type:border-b"
> >
<div class="pt-2 pb-2 px-5 leading-[1.5rem] flex items-center flex-nowrap"> <div class="body-cell pt-2 pb-2 px-5 leading-[1.5rem] flex items-center flex-nowrap">
{{ data.key }} {{ data.key }}
</div> </div>
<div class="pt-2 pb-2 px-5 leading-[1.5rem] flex items-center flex-nowrap"> <div class="body-cell pt-2 pb-2 px-5 leading-[1.5rem] flex items-center flex-nowrap">
<div class="flex-auto w-full"> <div class="flex-auto w-full">
<component <component
:is="FieldComponent" :is="FieldComponent"
@@ -83,7 +83,7 @@ defineExpose({
</div> </div>
</div> </div>
<div <div
class="pt-2 pb-2 px-5 leading-[1.5rem] flex items-center flex-nowrap w-full" class="body-cell pt-2 pb-2 px-5 leading-[1.5rem] flex items-center flex-nowrap w-full"
> >
<p <p
class="line-clamp-2" class="line-clamp-2"

View File

@@ -54,14 +54,16 @@ const bodyStyle = computed(() => {
}; };
}); });
function init() { function init(force = false) {
if (!modelValue.value) { const nextValue = { ...(modelValue.value ?? {}) };
modelValue.value = {};
}
for (const param of props.params) { for (const param of props.params) {
modelValue.value[param.key] = param.defaultValue ?? null; if (force || nextValue[param.key] === undefined) {
nextValue[param.key] = param.defaultValue ?? null;
}
} }
modelValue.value = nextValue;
} }
function toggleCollapsed() { function toggleCollapsed() {
@@ -84,7 +86,7 @@ function resetValue() {
rowRef.reset(); rowRef.reset();
} }
init(); init(true);
} }
init(); init();
@@ -108,17 +110,17 @@ defineExpose({
class="header bg-accent w-full flex-none flex items-center rounded-t-[0.5rem] border-b" class="header bg-accent w-full flex-none flex items-center rounded-t-[0.5rem] border-b"
> >
<div <div
class="pt-2 pb-2 px-5 leading-[1.5rem] flex items-center flex-nowrap" class="header-cell pt-2 pb-2 px-5 leading-[1.5rem] flex items-center flex-nowrap"
> >
参数名称 参数名称
</div> </div>
<div <div
class="pt-2 pb-2 px-5 leading-[1.5rem] flex items-center flex-nowrap" class="header-cell pt-2 pb-2 px-5 leading-[1.5rem] flex items-center flex-nowrap"
> >
配置 配置
</div> </div>
<div <div
class="pt-2 pb-2 px-5 leading-[1.5rem] flex items-center flex-nowrap" class="header-cell pt-2 pb-2 px-5 leading-[1.5rem] flex items-center flex-nowrap"
> >
说明 说明
</div> </div>