Skip to content

feat: 支持useVbenForm的dependencies.triggerFields为嵌套字段 #6296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {

import { computed, ref, watch } from 'vue';

import { isBoolean, isFunction } from '@vben-core/shared/utils';
import { getNestedValue, isBoolean, isFunction } from '@vben-core/shared/utils';

import { useFormValues } from 'vee-validate';

Expand Down Expand Up @@ -37,6 +37,10 @@ export default function useDependencies(
// 该字段可能会被多个字段触发
const triggerFields = getDependencies()?.triggerFields ?? [];
return triggerFields.map((dep) => {
// 支持嵌套字段访问,如 'config.name'
if (dep.includes('.')) {
return getNestedValue(values.value, dep);
}
return values.value[dep];
});
});
Expand Down