Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
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
linweijiong
jinfa-platform
Commits
1219129b
Commit
1219129b
authored
Dec 02, 2021
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: 删除 extra 属性
parent
4f14490b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
index.tsx
src/components/AddressSelect/index.tsx
+9
-10
No files found.
src/components/AddressSelect/index.tsx
View file @
1219129b
...
...
@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-08-05 10:28:06
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-12-02 1
0:53:32
* @LastEditTime: 2021-12-02 1
5:35:07
* @Description: 地址选择 FormItem
*/
import
React
,
{
useState
,
useEffect
,
useMemo
,
useRef
}
from
'react'
;
...
...
@@ -119,10 +119,6 @@ interface IProps {
* 是否显示下拉框
*/
echo
?:
boolean
,
/**
* 只显示文字
*/
extra
?:
React
.
ReactNode
,
}
export
type
SubmitValuesType
=
{
...
...
@@ -185,7 +181,6 @@ const AddressSelect: React.FC<IProps> = (props) => {
disabled
=
false
,
editable
=
true
,
echo
=
false
,
extra
,
}
=
props
;
const
[
list
,
setList
]
=
useState
<
AddressValueType
[]
>
([]);
const
[
internalValue
,
setInternalValue
]
=
useState
<
AddressValueType
>
();
...
...
@@ -602,8 +597,8 @@ const AddressSelect: React.FC<IProps> = (props) => {
label
:
`
${
item
.
name
}
${
item
.
fullAddress
}
${
item
.
phone
}
`
,
}));
},
[
list
]);
if
(
!
editable
)
{
const
renderAddressStr
=
()
=>
{
const
current
=
list
.
find
((
item
)
=>
item
.
id
===
value
?.
id
);
const
full
=
current
?
`
${
current
.
name
}
${
current
.
fullAddress
}
${
current
.
phone
}
`
:
null
;
const
isStr
=
typeof
value
===
'string'
;
...
...
@@ -611,6 +606,10 @@ const AddressSelect: React.FC<IProps> = (props) => {
return
(
<
div
>
{
full
||
(
!
isStr
?
`${value?.name || ''} ${value?.fullAddress || ''} ${value?.phone || ''}`
:
value
)
}
</
div
>
);
};
if
(
!
editable
)
{
return
renderAddressStr
();
}
return
(
...
...
@@ -636,7 +635,7 @@ const AddressSelect: React.FC<IProps> = (props) => {
)
}
{
echo
&&
(
<
div
className=
{
styles
[
'address-select-input'
]
}
>
{
extra
}
{
renderAddressStr
()
}
</
div
>
)
}
<
Button
...
...
@@ -644,7 +643,7 @@ const AddressSelect: React.FC<IProps> = (props) => {
className=
{
styles
[
'address-select-action'
]
}
disabled=
{
disabled
}
>
管理
更改
</
Button
>
</
div
>
...
...
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