removeQuestion() {
this.$emit('removeQuestion', this.index)
}
<div class="row" v-for="(question, index) in questions" :key="index">
<question v-model="questions[index]" :index="index" :questions="questions[index]" @removeQuestion="removeQuestion"/>
</div>
...mapActions('tests/newtest', [
'removeQuestion'
]),
<div class="input-group">
<input type="text" v-model="question.question" class="form-control">
<div class="input-group-addon"><a href="#" @click.prevent="removeQuestion">X</a></div>
</div>
removeQuestion ({ commit }, index) {
commit('removeQuestion',index)
}
removeQuestion(state,index) {
state.test.questions.splice(index, 1);
}
let questions = state.test.questions
questions.splice(index, 1)