fix dataTable other fetch params

This commit is contained in:
zuiidea
2017-03-20 10:58:26 +08:00
parent 19d5c3c4bd
commit d8ca570348
2 changed files with 5 additions and 3 deletions
+2 -1
View File
@@ -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
+3 -2
View File
@@ -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