File tree Expand file tree Collapse file tree 1 file changed +35
-7
lines changed Expand file tree Collapse file tree 1 file changed +35
-7
lines changed Original file line number Diff line number Diff line change 2929 <div class =" content" >
3030 <transition :enter-active-class =" enterAnimation" :leave-active-class =" leaveAnimation" mode =" out-in" >
3131 <!-- If keep alive-->
32- <keep-alive v-if =" keepAlive " >
32+ <keep-alive v-if =" keepAliveData " >
3333 <component :is =" steps[currentStep.index].component" :clickedNext =" nextButton[currentStep.name]" @can-continue =" proceed" @change-next =" changeNextBtnValue" :current-step =" currentStep" ></component >
3434 </keep-alive >
3535 <!-- If not show component and destroy it in each step change-->
@@ -90,6 +90,10 @@ export default {
9090 keepAlive: {
9191 type: Boolean ,
9292 default: true
93+ },
94+ reset: {
95+ type: Boolean ,
96+ default: false
9397 }
9498 },
9599
@@ -99,7 +103,8 @@ export default {
99103 previousStep: {},
100104 nextButton: {},
101105 canContinue: false ,
102- finalStep: false
106+ finalStep: false ,
107+ keepAliveData: this .keepAlive
103108 };
104109 },
105110
@@ -194,15 +199,38 @@ export default {
194199 changeNextBtnValue (payload ) {
195200 this .nextButton [this .currentStep .name ] = payload .nextBtnValue ;
196201 this .$forceUpdate ();
202+ },
203+
204+ init () {
205+ // Initiate stepper
206+ this .activateStep (0 );
207+ this .steps .forEach (step => {
208+ this .nextButton [step .name ] = false ;
209+ });
210+ }
211+ },
212+
213+ watch: {
214+ reset (val ) {
215+ if (! val) {
216+ return ;
217+ }
218+
219+ this .keepAliveData = false ;
220+
221+ this .init ();
222+ this .previousStep = {};
223+
224+ this .$nextTick (() => {
225+ this .keepAliveData = this .keepAlive ;
226+ this .$emit (' reset' , true );
227+ });
228+
197229 }
198230 },
199231
200232 created () {
201- // Initiate stepper
202- this .activateStep (0 );
203- this .steps .forEach (step => {
204- this .nextButton [step .name ] = false ;
205- });
233+ this .init ();
206234 }
207235};
208236 </script >
You can’t perform that action at this time.
0 commit comments