mirror of
https://github.com/zuiidea/antd-admin
synced 2026-10-21 15:04:26 +00:00
fix dataTable other fetch params
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user