0๐
โ
<tbody>
<tr v-for="paperId in QuestionPapersArray">
<td>{{ paperId }}</td>
<td></td>
<th></th>
<th><button class="btn" @click="takeExam(paperId)">Take Exam</button></th>
</tr>
</tbody>
Try the following.
methods: {
takeExam (paperId) {
this.$router.push(`/startExam/${paperId}`)
}
}
Alternatively, you can try the following inside the takeExam()
method
this.$router.push({
path: '/startExam',
params: {
id: paperId
}
})
Your route config file should be path: '/startExam/:id'
Source:stackexchange.com