diff --git a/ui/src/components/COMPONENT_README.md b/ui/src/components/COMPONENT_README.md index d522c4ee0bd..fc4a29e6bf9 100644 --- a/ui/src/components/COMPONENT_README.md +++ b/ui/src/components/COMPONENT_README.md @@ -712,7 +712,10 @@ const roleSettings = defineModel<{ roleId: string; workspaceIds: string[] }[]>({ ``` -`addText` 设置添加按钮文案。删除按钮及第一行与后续行的对齐由组件统一处理。 +`addText` 设置添加按钮文案,`showAddButton` 默认为 `true`;添加入口由业务布局单独提供时传入 +`:show-add-button="false"`。`firstRowHasLabel` 默认为 `true`:第一行删除按钮使用 `mt-8`,后续行 +使用 `mt-0.5`;并列表单项没有 label 时传入 `:first-row-has-label="false"`。删除成功后通过 +`remove(item, index)` 返回被删除的行数据和原索引,业务组件可处理关联状态,不需要再次修改列表。 ### MkSearchList diff --git a/ui/src/components/mk-dynamics-form/Demo.vue b/ui/src/components/mk-dynamics-form/Demo.vue index 0e5f1ed6599..5f683ceb31b 100644 --- a/ui/src/components/mk-dynamics-form/Demo.vue +++ b/ui/src/components/mk-dynamics-form/Demo.vue @@ -177,7 +177,7 @@ const validateForm = async () => { - { 取消 确定 - + diff --git a/ui/src/components/mk-dynamics-form/FormItem.vue b/ui/src/components/mk-dynamics-form/FormItem.vue index 975ee969a66..62d2c7064c3 100644 --- a/ui/src/components/mk-dynamics-form/FormItem.vue +++ b/ui/src/components/mk-dynamics-form/FormItem.vue @@ -59,7 +59,7 @@ const emit = defineEmits<{ }>() const loading = ref(false) -const fieldComponentRef = ref() +const componentFormRef = ref() const triggerSubscriptions: Array<{ event: string handler: (value: unknown) => void @@ -188,7 +188,7 @@ onBeforeUnmount(() => { function validate() { if (props.formField.trigger_type === 'CHILD_FORMS') { - return fieldComponentRef.value?.validate?.() ?? Promise.resolve() + return componentFormRef.value?.validate?.() ?? Promise.resolve() } return Promise.resolve() } @@ -203,7 +203,6 @@ defineExpose({ validate }) :style="formItemStyle" :prop="formField.field" :rules="validationRules" - :class="formField.required_asterisk ? 'hide-asterisk' : ''" >