diff --git a/src/components/DataTable/DataTable.js b/src/components/DataTable/DataTable.js index 8b7eda2..610f8de 100644 --- a/src/components/DataTable/DataTable.js +++ b/src/components/DataTable/DataTable.js @@ -51,7 +51,7 @@ class DataTable extends React.Component { } fetch = () => { - const { fetch: { url, data, dataKey } } = this.props + const { fetch: { url, data, dataKey, ...otherFetch } } = this.props const { fetchData } = this.state this.setState({ loading: true }) request(url, { @@ -60,6 +60,7 @@ class DataTable extends React.Component { ...data, ...fetchData, }, + ...otherFetch, }).then((result) => { const { pagination } = this.state pagination.total = result.total || pagination.total diff --git a/src/utils/request.js b/src/utils/request.js index 566ff54..febe924 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -7,11 +7,12 @@ export default function request (url, options) { format: 'json', }) } + const { method = 'get' } = options return Ajax.ajax({ url, - method: options.method || 'get', + method, data: options.data || {}, - processData: options.method === 'get', + processData: method === 'get', dataType: 'JSON', }).done((data) => { return data