This commit is contained in:
万纯 2021-04-09 11:12:58 +08:00
commit 3c7222eb5d
4 changed files with 9 additions and 7 deletions

View File

@ -1,5 +1,5 @@
{ {
"version": "2.0.0-rc.12", "version": "2.0.0-rc.13",
"changelog": { "changelog": {
"repo": "WeBankFinTech/fes.js", "repo": "WeBankFinTech/fes.js",
"cacheDir": ".changelog", "cacheDir": ".changelog",

View File

@ -1,6 +1,6 @@
{ {
"name": "@fesjs/plugin-request", "name": "@fesjs/plugin-request",
"version": "2.0.0-rc.11", "version": "2.0.0-rc.13",
"description": "@fesjs/plugin-request", "description": "@fesjs/plugin-request",
"main": "lib/index.js", "main": "lib/index.js",
"files": [ "files": [

View File

@ -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();
}; };

View File

@ -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,