Skip to content
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

formCreate.create(rule).fields() 返回表单字段名的顺序问题 #576

Open
liuhai2016 opened this issue Feb 24, 2023 · 1 comment
Open

Comments

@liuhai2016
Copy link

版本号 (version) @form-create/element-ui@2.5.17

UI 框架的版本 (UI version) element-ui 2.13.0

问题描述 (Issue)
当 rule 里的配置有 control 时,formCreate.create() 根据 rule 创建表单实例 fApi,使用 fApi.fields() 获取的表单全部字段名时,control 中配置的表单项的名字全是 push 到数组末尾的,并不是跟随在 control 的父级的字段后面,或根据 prepend 或 append 的设置排放。

复现步骤/生成规则 (Duplicate steps/generate rules)
const rule = [
{
"type": "select",
"field": "distributor",
"title": "经销商名称",
"_fc_drag_tag": "select",
"hidden": false,
"display": true,
"control": [
{
"handle": val => true,
"prepend": "distributor",
"rule": [
{
"type": "input",
"value": "",
"field": "dealerCode",
"title": "经销商编码",
"_fc_drag_tag": "input",
"hidden": false,
"display": true
}
]
}
]
},
{
"type": "input",
"field": "Fmkr1ng9y8slnq",
"title": "输入框",
"info": "",
"_fc_drag_tag": "input",
"hidden": false,
"display": true
}
]
formCreate.create(ruleTest).fields()
输出:['distributor', 'inputbox', 'dealerCode']

期望的结果 (Desired outcome)
因为 control 中写了 "prepend": "distributor",则希望输出: ['dealerCode', 'distributor', 'inputbox']
没有 prepend 时,默认为: ['distributor', 'dealerCode', 'inputbox']
若设置了 append,则排在 append 的后面。

各位大佬帮我看看喃,是我使用、理解错误了,还是说 form-create 确实有这个问题。

@liuhai2016 liuhai2016 changed the title formCreate.create(rule).fields() 返回表单字段命的顺序问题 formCreate.create(rule).fields() 返回表单字段名的顺序问题 Feb 24, 2023
@wuwenyuan111
Copy link

官方例子好像就是这样的,不知道有什么方法可以处理掉。

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

2 participants