File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed
lowcoder-comp-stone-parcel-input/src Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -112,10 +112,11 @@ let StoneParcelComp = new UICompBuilder(
112
112
const handleClose = ( i : number ) => {
113
113
setParcelValues ( parcelValues . toSpliced ( i , 1 ) ) ;
114
114
} ;
115
- const handleAdd = ( ) => {
116
- setParcelValues ( [ ...parcelValues , initValue ] ) ;
117
- props . data [ parcelValues . length ] = initValue ;
118
- } ;
115
+ useEffect ( ( ) => {
116
+ parcelValues . map ( ( parcelValue , i ) => {
117
+ props . data [ i ] = parcelValue ;
118
+ } ) ;
119
+ } , [ props , parcelValues ] ) ;
119
120
120
121
const [ dimensions , setDimensions ] = useState ( { width : 480 , height : 280 } ) ;
121
122
const {
@@ -152,7 +153,7 @@ let StoneParcelComp = new UICompBuilder(
152
153
type = "primary"
153
154
shape = "circle"
154
155
icon = { < PlusOutlined /> }
155
- onClick = { handleAdd ( ) }
156
+ onClick = { ( ) => setParcelValues ( [ ... parcelValues , initValue ] ) }
156
157
> </ antd . Button >
157
158
</ Container >
158
159
) ;
Original file line number Diff line number Diff line change @@ -101,10 +101,7 @@ function StoneParcel({
101
101
type = "primary"
102
102
shape = "circle"
103
103
icon = { < CloseOutlined /> }
104
- onClick = { ( ) => {
105
- handleClose ( key ) ;
106
- data . splice ( i , 1 ) ;
107
- } }
104
+ onClick = { ( ) => handleClose ( key ) }
108
105
> </ antd . Button >
109
106
</ Row >
110
107
) ;
You can’t perform that action at this time.
0 commit comments