File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
packages/components-vue/src/components/form Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 103
103
</template >
104
104
105
105
<script setup lang="ts">
106
- import { ref } from " vue" ;
106
+ import { ref , watch } from " vue" ;
107
107
import _ from " lodash" ;
108
108
109
109
import type { iInvalidInput , tProps } from " @open-xamu-co/ui-common-types" ;
185
185
if (Array .isArray (successOrInvalid )) invalid .value = successOrInvalid ;
186
186
else {
187
187
emit (" submited" , successOrInvalid );
188
- resetStages (); // reset form
188
+ resetStages (props . stages ); // reset form
189
189
}
190
190
});
191
191
192
192
function getLocalFormInputsKey(stageIndex : number , formIndex : number ) {
193
193
return ` form-${stageIndex }-${formIndex } ` ;
194
194
}
195
- function resetStages() {
195
+ function resetStages(newStages : iForm [][] ) {
196
196
// reset
197
197
localStages .value = [];
198
198
localFormInputs .value = {};
199
199
200
- props . stages
200
+ newStages
201
201
.filter ((s ) => s .length )
202
202
.forEach ((stage , stageIndex ) => {
203
203
const keys: string [] = [];
232
232
233
233
// lifecycle
234
234
emit (" set-active-stage" , setActiveStage );
235
- resetStages ();
235
+
236
+ watch (() => props .stages , resetStages , { immediate: true });
236
237
</script >
You can’t perform that action at this time.
0 commit comments