Feature request: Programmatic Navigation Between Questions
Waterloo opened this issue · 2 comments
Waterloo commented
Is your feature request related to a problem? Please describe.
Currently, Flow form doesn't have an option to navigate between questions and sections programmatically, this will be useful when using it along with Vue-router or any other Vue components and libraries.
Describe the solution you'd like
Add a method to navigate between questions based on a key or index in the questions array.
spinn commented
Thanks for the suggestion, we think it's a good idea and will make sure to add this in a future version.
spinn commented
To do this, you need to register a reference to the FlowForm component and use the goToNextQuestion
and goToPreviousQuestion
methods, eg.:
<template>
<flow-form
ref="flowform"
:questions="questions"
></flow-form>
</template>
<script>
export default {
components: {
FlowForm
},
data() {
return {
questions: []
}
},
mounted() {
// Go forwards if the next question is available
this.$refs.flowform.goToNextQuestion()
// Go backwards if the previous question is available
this.$refs.flowform.goToPreviousQuestion()
}
}
</script>