Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-admin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project
jinfa-admin
Commits
cec9fbcd
Commit
cec9fbcd
authored
Jun 02, 2021
by
Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: niceForm currentState不存在问题
parent
a68d4ac3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
+14
-4
index.tsx
src/components/NiceForm/index.tsx
+14
-4
No files found.
src/components/NiceForm/index.tsx
View file @
cec9fbcd
...
...
@@ -29,6 +29,7 @@ import SmilingFace from './components/SmilingFace';
import
AntUpload
from
'./components/AntUpload'
;
import
'./index.less'
import
{
currentStateType
,
getCurrentState
}
from
'./utils/keepAlive'
;
import
{
useRouteMatch
}
from
'umi'
;
export
interface
NiceFormProps
extends
IAntdSchemaFormProps
{}
...
...
@@ -102,15 +103,24 @@ export const componentExport = {
}
const
NiceForm
:
React
.
FC
<
NiceFormProps
>
=
props
=>
{
const
{
children
,
components
,
...
reset
}
=
props
;
const
match
=
useRouteMatch
();
const
defineComponents
=
Object
.
assign
(
componentExport
,
components
);
useEffect
(()
=>
{
let
paginationInfo
:
currentStateType
=
getCurrentState
();
// @ts-ignore
reset
.
actions
.
setFormState
(
state
=>
(
state
.
values
=
paginationInfo
.
queryParams
),
);
// 一般 列表检索传入的 controlRender 的 NiceForm 是没有 value 或者 initialValues 的
// value 或者 initialValues 的,表单页有
if
(
paginationInfo
&&
match
.
path
===
paginationInfo
.
pathname
&&
!
(
'value'
in
reset
)
&&
!
(
'initialValues'
in
reset
)
)
{
// @ts-ignore
reset
.
actions
.
setFormState
(
state
=>
(
state
.
values
=
paginationInfo
.
queryParams
),
);
}
},
[])
return
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment