::: tip 注意:
- 不能有 result 的参数,默认为 APP 结果变量
- 动作参数顺序,要保证和函数的参数顺序一致
:::
app.json
APP 配置文件
{"identification": "w5soar", // w5soar 签名,无需更改,必须存在"is_public": true, // 是否为公开 APP,设置 false 为私有 APP"name": "Hello Word", // APP 名称"version": "0.1", // APP 版本"description": "W5 SOAR - Hello Word", // APP 描述"type": "基本应用", // APP 分类"action": [ // APP 动作列表{"name": "HelloWord", // APP 动作名称"func": "hello_word" // 动作对应的函数名}],"args": { // 动作参数"hello_word": [ // 动作对应的函数名{"key": "name", // 动作参数名"type": "text", // 动作参数类型"required": true // 是否是必填项}]}}
多个动作
修改 action 字段
"action": [ // APP 动作列表{"name": "HelloWord", // APP 动作名称"func": "hello_word" // 动作对应的函数名},{"name": "test", // APP 动作名称"func": "app_test" // 动作对应的函数名},{"name": "demo", // APP 动作名称"func": "app_demo" // 动作对应的函数名}],
多个动作参数
"args": { // 动作参数"hello_word": [ // 动作对应的函数名{"key": "name", // 动作参数名"type": "text", // 动作参数类型"required": true // 是否是必填项}],"app_test": [ // 动作对应的函数名{"key": "name", // 动作参数名"type": "text", // 动作参数类型"required": true // 是否是必填项},{"key": "sex", // 动作参数名"type": "text", // 动作参数类型"required": true // 是否是必填项}],"app_demo": [ // 动作对应的函数名{"key": "name", // 动作参数名"type": "text", // 动作参数类型"required": true // 是否是必填项},{"key": "age", // 动作参数名"type": "text", // 动作参数类型"required": false // 是否是必填项},{"key": "test", // 动作参数名"type": "text", // 动作参数类型"required": false // 是否是必填项}]}
参数类型
为了提高用户体验,可以设置参数类型
"args": { // 动作参数"app_demo": [ // 动作对应的函数名{"key": "name", // 动作参数名"type": "text", // 动作参数类型"default": "W5", // 参数默认值,不写默认为空"required": true // 是否是必填项},{"key": "age", // 动作参数名"type": "number", // 动作参数类型"default": 18, // 参数默认值,不写默认为空"required": true // 是否是必填项},{"key": "desc", // 动作参数名"type": "textarea", // 动作参数类型"required": true // 是否是必填项},{"key": "type", // 动作参数名"type": "select", // 动作参数类型"default": "test", // 参数默认值,不写默认不选择"data": [ // 下拉列表"test","test2","test3","test4"],"required": true // 是否是必填项}]}
目前支持 5 种类型
| 类型 | 说明 | | —- | —- |
| text | 文本输入框 |
| password | 密码输入框 |
| textarea | 多行文本输入框 |
| number | 数字输入框 |
| select | 下拉选择框 |
