Page.jianghuAxios

12003

Resource Request Configuration

Use jianghuAxios on the frontend to send Resource requests

jianghuAxios is a lightweight wrapper around Axios provided by the JianghuJS framework. When sending a Resource request with jianghuAxios, the framework packages some data for you, but you still need to provide several parameters: pageId, actionId, actionData, where, sort, etc.

  • Example

Source: doUiAction.html in the basic project

  1. {% include 'common/jianghuAxios.html' %}
  2. <script>
  3. // Use jianghuAxios
  4. async getTableData() {
  5. const result = await window.jianghuAxios({
  6. data: {
  7. appData: {
  8. pageId: 'doUiAction',
  9. actionId: 'selectItemList',
  10. actionData: {},
  11. where: {},
  12. }
  13. }
  14. });
  15. this.tableData = result.data.appData.resultData.rows;
  16. },
  17. </script>

Parameter Reference

where, offset, and limit are only applicable for SQL resource scenarios.

Field Type Description
packageId String Required ✅ Unique ID of the request package; you can use a timestamp + random number, e.g., 1622720431076_3905352.
packageType String Required ✅ Package type; e.g., 'httpRequest', 'socketForward', 'socketRequest'.
appData Object Required ✅ Payload of the package.
└─ appId String Required ✅ Application ID; e.g., demo_xiaoapp.
└─ pageId String Required ✅ Page ID; e.g., demoPage.
└─ actionId String Required ✅ Operation ID; e.g., selectStudentList.
└─ authToken String Required ✅ User token.
└─ userAgent String Optional. Client browser info; obtain via window.navigator.userAgent.
└─ where Object Optional. where conditions; e.g., { name: '张三丰', classId: '2021-01级-02班' }.
└─ whereIn Object Optional. WHERE IN conditions; e.g., { name: ['张三丰', '张无忌'] }.
└─ whereLike Object Optional. Fuzzy WHERE conditions; e.g., { name: '张%' }.
└─ whereOptions Array Optional. where conditions as tuples; e.g., [['name', '=', 'zhangshan'], ['level', '>', 3], ['name', 'like', '%zhang%']].
└─ whereOrOptions Array Optional. where OR conditions; e.g., [['name', '=', 'zhangshan'], ['level', '>', 3], ['a', 100]].
└─ offset Number Optional. Query start index; e.g., 0.
└─ limit Number Optional. Page size (default: all); e.g., 10.
└─ orderBy Array Optional. Sorting; e.g., [{ column: 'age', order: 'desc' }].
└─ actionData Object Optional. Data for create/update operations, e.g., { name: '张三丰', level: '03' }.