Skip to content

Commit

Permalink
Merge branch 'master' of github.com:uiwjs/uiw-admin
Browse files Browse the repository at this point in the history
  • Loading branch information
SunLxy committed Feb 8, 2022
2 parents 70e3398 + 8448141 commit 90a6c09
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions examples/base/src/pages/Demo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ const Demo = () => {
<React.Fragment>
<ProTable
searchBtns={[
{ label: '搜索', type: 'primary', htmlType: 'submit' },
{
render: (
<Dropdown menu={menu} trigger="click" placement="bottomRight">
<Button type="primary">自定义下拉</Button>
<Button type="danger">搜索render</Button>
</Dropdown>
),
},
{ label: '点我', onClick: () => null },
]}
operateButtons={[
{
Expand All @@ -88,7 +88,7 @@ const Demo = () => {
onClick: handleEditTable.bind(this, 'add'),
},
{
render: <Button type="primary">自定义render</Button>,
render: <Button type="danger">操作render</Button>,
},
]}
columns={[
Expand Down
4 changes: 1 addition & 3 deletions examples/base/src/pages/TableList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ export default function Demo() {
},
// 格式化查询参数 会接收到pageIndex 当前页 searchValues 表单数据
query: (pageIndex, searchValues) => {
const { swr_Rest_Time, ...rest } = searchValues
return {
page: pageIndex,
pageSize: 10,
swr_Rest_Time,
data: { ...rest },
data: searchValues,
}
},
// swr options
Expand Down
8 changes: 5 additions & 3 deletions packages/utils/src/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,21 @@ export interface Options extends AxiosRequestConfig {
export default function request(url: string, options: Options = {}) {
const method = options.method || 'GET';
const { body } = options;
const { swr_Rest_Time, ...rest } = body || {};
const { data } = body;
// 删除swr_Rest_Time
data?.swr_Rest_Time && delete data.swr_Rest_Time;
const newOptions: Options = {
url,
method,
data: { ...rest },
data: { ...body },
headers: {
'Content-Type': 'application/json; charset=utf-8',
Accept: 'application/json',
},
};

if (/(GET)/.test(method)) {
newOptions.url = splitUrl(url, { ...rest });
newOptions.url = splitUrl(url, { ...body });
delete newOptions.body;
}

Expand Down

0 comments on commit 90a6c09

Please sign in to comment.