Page.jianghuAxios
12003Resource 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
{% include 'common/jianghuAxios.html' %}<script>// Use jianghuAxiosasync getTableData() {const result = await window.jianghuAxios({data: {appData: {pageId: 'doUiAction',actionId: 'selectItemList',actionData: {},where: {},}}});this.tableData = result.data.appData.resultData.rows;},</script>
Parameter Reference
where,offset, andlimitare 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' }. |