2022-02-11 18:54:23 +08:00
|
|
|
const getEventDesc = eventName => {
|
|
|
|
return {
|
|
|
|
actions: [
|
|
|
|
{
|
|
|
|
actionType: 'toast',
|
2022-04-20 15:20:42 +08:00
|
|
|
args: {
|
|
|
|
msgType: 'info',
|
2022-10-12 15:09:03 +08:00
|
|
|
msg: `派发${eventName}事件` + '${file|json}'
|
2022-04-20 15:20:42 +08:00
|
|
|
}
|
2022-02-11 18:54:23 +08:00
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const change = {
|
|
|
|
actions: [
|
|
|
|
{
|
2022-05-31 15:05:54 +08:00
|
|
|
actionType: 'toast',
|
2022-02-11 18:54:23 +08:00
|
|
|
args: {
|
2022-05-31 15:05:54 +08:00
|
|
|
msgType: 'info',
|
2022-10-12 15:09:03 +08:00
|
|
|
msg: '派发change事件${file|json}'
|
2022-02-11 18:54:23 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
2022-01-21 16:02:25 +08:00
|
|
|
export default {
|
|
|
|
type: 'page',
|
|
|
|
title: '上传类组件事件',
|
|
|
|
regions: ['body', 'toolbar', 'header'],
|
|
|
|
body: [
|
|
|
|
{
|
|
|
|
type: 'tpl',
|
|
|
|
tpl: 'InputFile上传类',
|
|
|
|
inline: false,
|
|
|
|
wrapperComponent: 'h2'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'form',
|
|
|
|
debug: true,
|
|
|
|
api: '/api/mock2/form/saveForm',
|
|
|
|
body: [
|
|
|
|
{
|
|
|
|
type: 'group',
|
|
|
|
body: [
|
|
|
|
{
|
|
|
|
name: 'trigger1',
|
|
|
|
id: 'trigger1',
|
|
|
|
type: 'action',
|
|
|
|
label: 'clear触发器',
|
|
|
|
level: 'primary',
|
|
|
|
onEvent: {
|
|
|
|
click: {
|
|
|
|
actions: [
|
|
|
|
{
|
|
|
|
actionType: 'clear',
|
|
|
|
componentId: 'clear-input-file',
|
|
|
|
description: '点击清除数据'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'input-file',
|
|
|
|
id: 'clear-input-file',
|
|
|
|
name: 'file',
|
2022-02-11 18:54:23 +08:00
|
|
|
multiple: true,
|
2022-05-31 15:05:54 +08:00
|
|
|
receiver: 'ddd',
|
2022-02-11 18:54:23 +08:00
|
|
|
onEvent: {
|
|
|
|
change,
|
|
|
|
remove: getEventDesc('remove'),
|
|
|
|
success: getEventDesc('success'),
|
|
|
|
fail: getEventDesc('fail')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'form',
|
|
|
|
debug: true,
|
|
|
|
api: '/api/mock2/form/saveForm',
|
|
|
|
body: [
|
|
|
|
{
|
|
|
|
type: 'group',
|
|
|
|
body: [
|
|
|
|
{
|
|
|
|
name: 'trigger2',
|
|
|
|
id: 'trigger2',
|
|
|
|
type: 'action',
|
|
|
|
label: 'clear触发器',
|
|
|
|
level: 'primary',
|
|
|
|
onEvent: {
|
|
|
|
click: {
|
|
|
|
actions: [
|
|
|
|
{
|
|
|
|
actionType: 'clear',
|
|
|
|
componentId: 'clear-input-image',
|
|
|
|
description: '点击清除数据'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'input-image',
|
|
|
|
id: 'clear-input-image',
|
|
|
|
name: 'file',
|
|
|
|
multiple: true,
|
|
|
|
onEvent: {
|
|
|
|
change,
|
|
|
|
remove: getEventDesc('remove'),
|
|
|
|
success: getEventDesc('success'),
|
|
|
|
fail: getEventDesc('fail')
|
|
|
|
}
|
2022-01-21 16:02:25 +08:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|