amis/examples/components/Form/Reaction.jsx

94 lines
2.2 KiB
React
Raw Normal View History

2019-04-30 11:11:25 +08:00
export default {
2019-11-07 10:41:14 +08:00
title: '显隐切换示例',
body: [
{
name: 'hiddenOn',
type: 'form',
mode: 'horizontal',
api: '/api/mock2/saveForm?waitSeconds=2',
title: 'Hide On 和 disabledOn 示例',
body: [
2019-04-30 11:11:25 +08:00
{
2019-11-07 10:41:14 +08:00
type: 'radios',
name: 'type',
label: '类型选择',
inline: true,
value: '1',
options: [
{
label: '类型 1',
value: '1'
},
{
label: '类型 2',
value: '2'
},
{
label: '类型 3',
value: '3'
}
],
description: '<span class="text-danger">请切换类型来看效果</span>'
},
{
type: 'input-text',
2019-11-07 10:41:14 +08:00
label: '所有可见',
name: 'text1'
},
{
type: 'input-text',
2019-11-07 10:41:14 +08:00
label: '类型2 可见',
hiddenOn: 'data.type != 2',
name: 'text2'
},
{
type: 'input-text',
2019-11-07 10:41:14 +08:00
label: '类型3 不可点',
disabledOn: 'data.type == 3',
name: 'text3'
},
{
type: 'input-text',
2019-11-07 10:41:14 +08:00
required: true,
label: '必填字段',
name: 'test4'
},
{
type: 'button-toolbar',
buttons: [
{
type: 'submit',
disabledOn: 'data.type == 1',
label: '类型1不可点'
},
{
type: 'reset',
label: '类型3出现且不可点',
visibleOn: 'data.type == 3',
disabledOn: 'data.type == 3'
},
{
type: 'button',
label: 'Baidu',
2020-09-16 16:40:19 +08:00
actionType: 'url',
url: 'http://www.baidu.com?a=1&b=$test4'
2019-11-07 10:41:14 +08:00
},
{
type: 'button',
actionType: 'ajax',
label: 'No Submit',
2020-09-16 16:40:19 +08:00
api: '/api/mock2/saveForm?waitSeconds=5'
2019-11-07 10:41:14 +08:00
},
{
type: 'submit',
actionType: 'ajax',
label: 'Submit',
2020-09-16 16:40:19 +08:00
api: '/api/mock2/saveForm?waitSeconds=5'
2019-11-07 10:41:14 +08:00
}
]
2019-04-30 11:11:25 +08:00
}
2019-11-07 10:41:14 +08:00
]
}
]
2019-04-30 11:11:25 +08:00
};