48 lines
1.4 KiB
JavaScript
Raw Normal View History

2024-04-23 13:12:02 +08:00
import { recursionDelete } from '/admin/components/catchForm/support'
const basicAttr = (omit = [], moreAttrs = []) => {
const attr = [
{ label: '标签', component: 'Input', name: 'label' },
{
label: '唯一标识',
component: 'Input',
name: 'name',
help: "既是唯一标识也是数据路径。比如输入【props.name】数据就会保存为 { props: { name:'xxx' } }"
},
{ label: '字段说明', component: 'Textarea', name: 'help' },
{
label: '占位提示',
component: 'Input',
name: 'props.placeholder',
designKey: 'form-ekRL'
},
{ label: '初始值', component: 'Input', name: 'initialValue' },
{
component: 'Grid',
children: [
{ label: '是否必填', component: 'Switch', name: 'required' },
{ label: '是否只读', component: 'Switch', name: 'props.readonly' },
{ label: '是否禁用', component: 'Switch', name: 'props.disabled' },
{ label: '隐藏字段', component: 'Switch', name: 'hidden' },
{ label: '隐藏标签', component: 'Switch', name: 'hideLabel' }
],
props: {
columns: 3,
'row-gap': 0,
'column-gap': 20
},
designKey: 'form-R003',
name: 'cNmCuu',
style: {
marginBottom: 0
}
}
]
const omitAttrs = recursionDelete(attr, (item) => !omit.includes(item.name))
return [...omitAttrs, ...moreAttrs]
}
export default basicAttr