::: tip 注意:

  • 不能有 result 的参数,默认为 APP 结果变量
  • 动作参数顺序,要保证和函数的参数顺序一致

:::

app.json

APP 配置文件

  1. {
  2. "identification": "w5soar", // w5soar 签名,无需更改,必须存在
  3. "is_public": true, // 是否为公开 APP,设置 false 为私有 APP
  4. "name": "Hello Word", // APP 名称
  5. "version": "0.1", // APP 版本
  6. "description": "W5 SOAR - Hello Word", // APP 描述
  7. "type": "基本应用", // APP 分类
  8. "action": [ // APP 动作列表
  9. {
  10. "name": "HelloWord", // APP 动作名称
  11. "func": "hello_word" // 动作对应的函数名
  12. }
  13. ],
  14. "args": { // 动作参数
  15. "hello_word": [ // 动作对应的函数名
  16. {
  17. "key": "name", // 动作参数名
  18. "type": "text", // 动作参数类型
  19. "required": true // 是否是必填项
  20. }
  21. ]
  22. }
  23. }

多个动作

修改 action 字段

  1. "action": [ // APP 动作列表
  2. {
  3. "name": "HelloWord", // APP 动作名称
  4. "func": "hello_word" // 动作对应的函数名
  5. },
  6. {
  7. "name": "test", // APP 动作名称
  8. "func": "app_test" // 动作对应的函数名
  9. },
  10. {
  11. "name": "demo", // APP 动作名称
  12. "func": "app_demo" // 动作对应的函数名
  13. }
  14. ],

多个动作参数

  1. "args": { // 动作参数
  2. "hello_word": [ // 动作对应的函数名
  3. {
  4. "key": "name", // 动作参数名
  5. "type": "text", // 动作参数类型
  6. "required": true // 是否是必填项
  7. }
  8. ],
  9. "app_test": [ // 动作对应的函数名
  10. {
  11. "key": "name", // 动作参数名
  12. "type": "text", // 动作参数类型
  13. "required": true // 是否是必填项
  14. },
  15. {
  16. "key": "sex", // 动作参数名
  17. "type": "text", // 动作参数类型
  18. "required": true // 是否是必填项
  19. }
  20. ],
  21. "app_demo": [ // 动作对应的函数名
  22. {
  23. "key": "name", // 动作参数名
  24. "type": "text", // 动作参数类型
  25. "required": true // 是否是必填项
  26. },
  27. {
  28. "key": "age", // 动作参数名
  29. "type": "text", // 动作参数类型
  30. "required": false // 是否是必填项
  31. },
  32. {
  33. "key": "test", // 动作参数名
  34. "type": "text", // 动作参数类型
  35. "required": false // 是否是必填项
  36. }
  37. ]
  38. }

参数类型

为了提高用户体验,可以设置参数类型

  1. "args": { // 动作参数
  2. "app_demo": [ // 动作对应的函数名
  3. {
  4. "key": "name", // 动作参数名
  5. "type": "text", // 动作参数类型
  6. "default": "W5", // 参数默认值,不写默认为空
  7. "required": true // 是否是必填项
  8. },
  9. {
  10. "key": "age", // 动作参数名
  11. "type": "number", // 动作参数类型
  12. "default": 18, // 参数默认值,不写默认为空
  13. "required": true // 是否是必填项
  14. },
  15. {
  16. "key": "desc", // 动作参数名
  17. "type": "textarea", // 动作参数类型
  18. "required": true // 是否是必填项
  19. },
  20. {
  21. "key": "type", // 动作参数名
  22. "type": "select", // 动作参数类型
  23. "default": "test", // 参数默认值,不写默认不选择
  24. "data": [ // 下拉列表
  25. "test",
  26. "test2",
  27. "test3",
  28. "test4"
  29. ],
  30. "required": true // 是否是必填项
  31. }
  32. ]
  33. }

目前支持 5 种类型

| 类型 | 说明 | | —- | —- |

| text | 文本输入框 |

| password | 密码输入框 |

| textarea | 多行文本输入框 |

| number | 数字输入框 |

| select | 下拉选择框 |