amis/examples/components/Services/Form.jsx

71 lines
1.6 KiB
React
Raw Normal View History

2019-04-30 11:11:25 +08:00
export default {
2019-11-07 10:41:14 +08:00
type: 'page',
title: '动态加载表单中的部分',
body: [
'<span class="text-danger">同样通过 <code>service</code>的<code>schemaApi</code> 来加载部分内容,当然也可以全部由它来加载</span>',
2019-04-30 11:11:25 +08:00
2019-11-07 10:41:14 +08:00
{
type: 'form',
panelClassName: 'Panel--info m-t',
target: 'service1',
mode: 'horizontal',
api: '/api/mock2/form/saveForm?waitSeconds=1',
body: [
2019-04-30 11:11:25 +08:00
{
type: 'fieldset',
2019-11-07 10:41:14 +08:00
title: '基本信息',
body: [
2019-11-07 10:41:14 +08:00
{
type: 'input-text',
2019-11-07 10:41:14 +08:00
label: '字段一',
name: 'filed1'
},
2019-04-30 11:11:25 +08:00
2019-11-07 10:41:14 +08:00
{
type: 'input-text',
2019-11-07 10:41:14 +08:00
label: '字段二',
name: 'filed2'
}
]
},
2019-04-30 11:11:25 +08:00
2019-11-07 10:41:14 +08:00
{
title: '其他信息',
type: 'fieldset',
body: [
2019-11-07 10:41:14 +08:00
{
name: 'tpl',
type: 'select',
label: '模板',
inline: true,
required: true,
value: 'tpl1',
options: [
2019-04-30 11:11:25 +08:00
{
2019-11-07 10:41:14 +08:00
label: '模板1',
value: 'tpl1'
},
{
label: '模板2',
value: 'tpl2'
},
{
label: '模板3',
value: 'tpl3'
2019-04-30 11:11:25 +08:00
}
2019-11-07 10:41:14 +08:00
]
},
{
type: 'service',
className: 'm-t',
initFetchSchemaOn: 'data.tpl',
schemaApi: '/api/mock2/service/form?tpl=$tpl'
}
]
2019-04-30 11:11:25 +08:00
}
2019-11-07 10:41:14 +08:00
]
}
]
};