diff --git a/lerna.json b/lerna.json index a8a675e2..e503a089 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.0.0-rc.12", + "version": "2.0.0-rc.13", "changelog": { "repo": "WeBankFinTech/fes.js", "cacheDir": ".changelog", diff --git a/packages/fes-plugin-request/package.json b/packages/fes-plugin-request/package.json index 59c8b6da..29029664 100644 --- a/packages/fes-plugin-request/package.json +++ b/packages/fes-plugin-request/package.json @@ -1,6 +1,6 @@ { "name": "@fesjs/plugin-request", - "version": "2.0.0-rc.11", + "version": "2.0.0-rc.13", "description": "@fesjs/plugin-request", "main": "lib/index.js", "files": [ diff --git a/packages/fes-plugin-request/src/template/setDataField.js b/packages/fes-plugin-request/src/template/setDataField.js index 3cbb76d8..33ea2204 100644 --- a/packages/fes-plugin-request/src/template/setDataField.js +++ b/packages/fes-plugin-request/src/template/setDataField.js @@ -1,10 +1,10 @@ import { isObject } from './helpers'; export default async (ctx, next) => { - const { dataField, response } = ctx; - if (response && isObject(response.data) && dataField) { - ctx.response._rawData = response.data; - ctx.response.data = response.data[dataField]; + const dataField = ctx.config.dataField ?? ctx.dataField; + if (ctx.response && isObject(ctx.response.data) && dataField) { + ctx.response._rawData = ctx.response.data; + ctx.response.data = ctx.response.data[dataField]; } await next(); }; diff --git a/packages/fes-template-h5/src/pages/index.vue b/packages/fes-template-h5/src/pages/index.vue index 185c11bb..29e5530c 100644 --- a/packages/fes-template-h5/src/pages/index.vue +++ b/packages/fes-template-h5/src/pages/index.vue @@ -28,7 +28,9 @@ export default { const clickIcon = () => { console.log('click Icon'); }; - const { loading, data } = useRequest('/api'); + const { loading, data } = useRequest('/api', null, { + dataField: false + }); return { loading, data,