Files
housemove3/Web/public/doc-code/api/usage.js
路 范 c03092bc0c .
2021-09-24 14:33:10 +08:00

25 lines
405 B
JavaScript

import { api } from 'common/api'
api.apiName(params)
.then(res => {
/* ... */
})
.catch(error => {
/* catch */
})
.finally(() => {
/* finally */
})
// 或者采用异步
async function foo() {
try {
const res = await api.apiName(params)
/* ... */
} catch (error) {
/* catch */
} finally {
/* finally */
}
}