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
shenshaokai
jinfa-platform
Commits
0b257e02
Commit
0b257e02
authored
Mar 23, 2022
by
Bill
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix0218' into 'v2-220218'
fix: 优化新增商品商品属性多选控件 See merge request linkseeks-design/pro-platform!20
parents
7bd7d662
bd431b04
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
271 additions
and
29 deletions
+271
-29
productAttributeForm.tsx
...mmodity/products/addProductsItem/productAttributeForm.tsx
+180
-29
index.less
...s/commodity/products/components/circleCheckbox/index.less
+31
-0
index.tsx
...es/commodity/products/components/circleCheckbox/index.tsx
+60
-0
No files found.
src/pages/commodity/products/addProductsItem/productAttributeForm.tsx
View file @
0b257e02
This diff is collapsed.
Click to expand it.
src/pages/commodity/products/components/circleCheckbox/index.less
0 → 100644
View file @
0b257e02
.circleCheckbox {
display: flex;
}
.circleCheckboxUl {
list-style: none;
display: flex;
.circleCheckboxUlLi {
// height: 32px;
line-height: 32px;
background: #F5F6F7;
text-align: center;
border-radius: 4px;
margin: 0 8px;
padding: 0px 16px;
cursor: pointer;
span {
font-weight: 400;
font-size: 12px;
color: #5C626A;
text-align: center;
}
}
.active {
background: rgba(0,169,143,0.04);
border: 1px solid #00A98F;
span {
color: #00A98F;
}
}
}
src/pages/commodity/products/components/circleCheckbox/index.tsx
0 → 100644
View file @
0b257e02
import
React
,
{
useState
,
useEffect
,
ReactNode
}
from
'react'
;
import
cx
from
'classnames'
import
styles
from
'./index.less'
interface
PriceInputProps
{
value
?:
number
[];
onChange
?:
(
value
:
number
[])
=>
void
;
options
:
any
;
expandOperation
?:
ReactNode
}
/**
* 新增商品 方形多选表单
* @returns
*/
const
CircleCheckbox
:
React
.
FC
<
PriceInputProps
>
=
({
value
=
[],
options
=
[],
onChange
,
expandOperation
=
null
})
=>
{
const
[
currentValue
,
setCurrentValue
]
=
useState
<
number
[]
>
([...
value
])
useEffect
(()
=>
{
onChange
?.([...
currentValue
])
},
[
currentValue
])
const
clickItem
=
(
id
)
=>
{
const
_value
=
[...
currentValue
]
if
(
_value
.
includes
(
id
))
{
var
index
=
_value
.
indexOf
(
id
)
if
(
index
>
-
1
)
{
_value
.
splice
(
index
,
1
)
}
setCurrentValue
([...
_value
])
}
else
{
_value
.
push
(
id
)
setCurrentValue
([...
_value
])
}
}
return
(
options
.
length
&&
<
div
className=
{
styles
.
circleCheckbox
}
>
<
ul
className=
{
styles
.
circleCheckboxUl
}
>
{
options
.
map
((
item
:
any
,
index
:
string
)
=>
(
<
li
key=
{
item
.
id
}
className=
{
currentValue
.
includes
(
item
.
id
)
?
cx
(
styles
.
active
,
styles
.
circleCheckboxUlLi
)
:
styles
.
circleCheckboxUlLi
}
onClick=
{
()
=>
clickItem
(
item
.
id
)
}
>
<
span
>
{
item
.
value
}
</
span
>
</
li
>
))
}
{
expandOperation
}
</
ul
>
</
div
>
)
}
export
default
CircleCheckbox
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