I want to invoke a methode, when the user selects one of the checkboxes which I am rendering via v-for
. They all are bound to one variable via v-model
. Though the problem is that the input
doesn't even seem to be available on v-checkbox
. And the following code doesn't do anything:
<template>
<v-container>
<v-layout row>
<v-flex xs12>
<v-layout justify-center>
<v-form ref="form" lazy-validation>
<v-checkbox
v-for="(answer, index) in questions[actualIndex].answers"
:key="index"
:ref="'check'+index"
:label="answer.answer"
:value="answer.answer"
v-model="checkbox"
@input="onInput()"
></v-checkbox>
</v-form>
</v-layout>
</v-flex>
</v-layout>
</v-container>
</template
export default { data() { return { checkbox: '' } }, methods: { onInput() { console.log("WORKS"); } } }
However if I use the @change
or @click
events instead, it works perfectly. Any ideas, what I am doing wrong?
Aucun commentaire:
Enregistrer un commentaire