amis2/examples/components/Linkage/Options.jsx

61 lines
1.3 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: {
type: 'form',
mode: 'horizontal',
title: '',
actions: [],
body: [
2019-11-07 10:41:14 +08:00
'<p class="text-danger">表单选项可以设置 source 通过 API 远程拉取,同时如果 source 中有变量的话,变量值发生变化就会重新拉取,达到联动效果。</p>',
{
type: 'divider'
},
2019-04-30 11:11:25 +08:00
2019-11-07 10:41:14 +08:00
{
label: '选项1',
type: 'select',
labelClassName: 'text-muted',
name: 'a',
inline: true,
options: [
{
label: '选项1',
value: 1
},
2019-04-30 11:11:25 +08:00
2019-11-07 10:41:14 +08:00
{
label: '选项2',
value: 2
},
2019-04-30 11:11:25 +08:00
2019-11-07 10:41:14 +08:00
{
label: '选项3',
value: 3
}
]
},
2019-04-30 11:11:25 +08:00
2019-11-07 10:41:14 +08:00
{
label: '选项2',
type: 'select',
labelClassName: 'text-muted',
name: 'b',
inline: true,
source: '/api/mock2/options/level2?a=${a}',
initFetchOn: 'data.a'
},
2019-04-30 11:11:25 +08:00
2019-11-07 10:41:14 +08:00
{
label: '选项3',
type: 'select',
labelClassName: 'text-muted',
name: 'c',
inline: true,
visibleOn: 'data.b',
source: '/api/mock2/options/level3?b=${b}'
}
]
}
};