mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-09-01 12:25:41 +08:00
feat: request dataField 支持覆盖
This commit is contained in:
parent
d21c00a558
commit
dced6a92ea
@ -1,10 +1,10 @@
|
|||||||
import { isObject } from './helpers';
|
import { isObject } from './helpers';
|
||||||
|
|
||||||
export default async (ctx, next) => {
|
export default async (ctx, next) => {
|
||||||
const { dataField, response } = ctx;
|
const dataField = ctx.config.dataField ?? ctx.dataField;
|
||||||
if (response && isObject(response.data) && dataField) {
|
if (ctx.response && isObject(ctx.response.data) && dataField) {
|
||||||
ctx.response._rawData = response.data;
|
ctx.response._rawData = ctx.response.data;
|
||||||
ctx.response.data = response.data[dataField];
|
ctx.response.data = ctx.response.data[dataField];
|
||||||
}
|
}
|
||||||
await next();
|
await next();
|
||||||
};
|
};
|
||||||
|
@ -28,7 +28,9 @@ export default {
|
|||||||
const clickIcon = () => {
|
const clickIcon = () => {
|
||||||
console.log('click Icon');
|
console.log('click Icon');
|
||||||
};
|
};
|
||||||
const { loading, data } = useRequest('/api');
|
const { loading, data } = useRequest('/api', null, {
|
||||||
|
dataField: false
|
||||||
|
});
|
||||||
return {
|
return {
|
||||||
loading,
|
loading,
|
||||||
data,
|
data,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user