Based on the code provided, it seems that the issue is not with the Vue form itself, but with the router not properly redirecting to the desired pages after the form is submitted.
One possible solution is to make sure that the router is properly imported and initialized in the Vue component that contains the form. Here's an example of how this can be done:
<template>
<div>
<!-- form code here -->
</div>
</template>
<script>
import router from '@/router' // import the router from the router file
export default {
data() {
return {
saveClicked: false,
// other data properties here
}
},
methods: {
onSubmit() {
// form submission code here
if (response.data.success == true) {
if (this.saveClicked) {
// redirect to member questionnaire page
router.push({ path: '/member/member-questionnaire' });
} else {
// redirect to questionnaire page
router.push('/questionnaire');
}
} else {
// error handling code here
}
}
}
}
</script>
In this example, we import the router from the router file and initialize it in the Vue component. Then, in the onSubmit method, we use the router.push method to redirect to the desired pages based on the value of saveClicked.
Make sure to adjust the code to fit your specific use case and file structure.