Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
xiaojuan huang
Ccms
Commits
fb1b2541
Commit
fb1b2541
authored
3 years ago
by
wangailin
Browse files
Options
Download
Email Patches
Plain Diff
feat: 补充修复单多选项回显
parent
1864b2f5
v1.0.9-beta
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/formFields/select/multiple/index.tsx
+13
-15
src/components/formFields/select/multiple/index.tsx
src/components/formFields/select/single/index.tsx
+1
-1
src/components/formFields/select/single/index.tsx
with
14 additions
and
16 deletions
+14
-16
src/components/formFields/select/multiple/index.tsx
+
13
-
15
View file @
fb1b2541
...
...
@@ -119,24 +119,22 @@ export default class SelectMultipleField extends SelectField<SelectMultipleField
placeholder
}
if
(
multiple
===
true
||
multiple
?.
type
===
'
array
'
)
{
if
(
Array
.
isArray
(
value
))
{
props
.
value
=
(
value
as
Array
<
string
|
number
>
)
}
else
if
(
value
!==
undefined
)
{
props
.
value
=
undefined
console
.
warn
(
'
数组类型的多项选择框的值需要是字符串或数值的数组。
'
)
if
(
Array
.
isArray
(
value
))
{
props
.
value
=
(
value
as
Array
<
string
|
number
>
)
}
else
if
(
typeof
value
===
'
string
'
)
{
if
(
multiple
===
true
)
{
props
.
value
=
String
(
value
).
split
(
'
,
'
)
}
else
if
(
multiple
?.
type
===
'
split
'
&&
multiple
?.
split
)
{
props
.
value
=
String
(
value
).
split
(
multiple
.
split
)
}
else
{
props
.
value
=
String
(
value
).
split
(
'
,
'
)
}
}
else
if
(
multiple
?.
type
===
'
split
'
)
{
if
(
typeof
value
===
'
string
'
)
{
props
.
value
=
String
(
value
).
split
(
multiple
.
split
||
'
,
'
)
}
else
if
(
value
!==
undefined
)
{
props
.
value
=
undefined
console
.
warn
(
'
字符串分隔类型的多项选择框的值需要是字符串。
'
)
}
}
else
{
props
.
value
=
Array
.
isArray
(
value
)
?
value
:
undefined
}
else
if
(
value
!==
undefined
)
{
props
.
value
=
undefined
console
.
warn
(
'
数组类型的多项选择框的值需要是字符串或数值的数组。
'
)
}
console
.
log
(
props
.
value
)
if
(
props
.
value
!==
undefined
)
{
props
.
value
.
filter
((
v
)
=>
{
if
(
props
.
options
.
map
((
option
)
=>
option
.
value
).
includes
(
v
.
toString
()))
{
...
...
This diff is collapsed.
Click to expand it.
src/components/formFields/select/single/index.tsx
+
1
-
1
View file @
fb1b2541
...
...
@@ -58,7 +58,7 @@ export default class SelectSingleField extends SelectField<SelectSingleFieldConf
}
defaults
=
undefined
}
else
{
if
(
typeof
defaults
!==
'
string
'
||
typeof
defaults
!==
'
number
'
)
{
if
(
typeof
defaults
!==
'
string
'
&&
typeof
defaults
!==
'
number
'
)
{
console
.
warn
(
'
单项选择框的值需要是字符串或数值。
'
)
defaults
=
undefined
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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
Menu
Projects
Groups
Snippets
Help