Skip to content

获取表单层级结构api getFormDescription没有返回option #189

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
leikui opened this issue Mar 27, 2025 · 1 comment
Open

获取表单层级结构api getFormDescription没有返回option #189

leikui opened this issue Mar 27, 2025 · 1 comment

Comments

@leikui
Copy link

leikui commented Mar 27, 2025

有一个需求需要使用 options 中的数据作为判断条件,现在该怎么实现

@leikui
Copy link
Author

leikui commented Mar 27, 2025

export const getFormRuleDescription = (tree) => {
const getTree = (children) => {
const tree = [];
children && children.forEach(rule => {
if (rule.field) {
rule.children = getTree(rule.children || []);
if (!rule.children.length) {
delete rule.children;
}
if (rule.options) {
rule.options = {...rule.options};
}
tree.push(rule);
} else {
tree.push(...getTree(rule.children || []));
}
});
return tree;
}
return getTree(tree);
};能否添加 if (rule.options) {
rule.options = {...rule.options};
}这行

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant