0👍
✅
You should pass currentStep
as a prop in your <Form />
component and instead of method use computed property to pass the component name dynamically.
computed: {
currentStep() {
return this.steps[this.stepIndex];
},
}
Live Demo : codesandbox
0👍
Because you haven’t passed currentStep
to Form
in App.vue
Please fix the following and it will work:
- Delete
currentStep
frommethods
inApp.vue
- Add
computed
currentStep
toApp.vue
:
...
computed: {
currentStep() {
return this.steps[this.stepIndex]
}
}
...
- add prop
currentStep
toForm
inApp.vue
:
...
<Form
...
:current-step="currentStep"
/>
...
also you should consider the new syntax of vue 3 or sfc
avoid using
provide
your code is crashing switch toprops
Source:stackexchange.com