<Row type="flex" justify="start" v-for="(item,index) in questions" :key="item.id">
<div class="question">
<h5 class="question_title">{{index+1}}.{{item.title}}</h5>
<RadioGroup v-if="item.questionType == """ v-model="answerInfo[index].singlechoice_default" vertical>
<Radio v-for="(it,i) in item.options" :label="it.id" :key="it.id" :checked.native="item.checked">
<span v-if="it.optionContent.indexOf("-sharpOTHER-sharp") == "-1"">{{it.optionContent}}</span>
<span v-else><Input v-if="it.optionContent.indexOf("-sharpOTHER-sharp") != "-1""></Input></span>
</Radio>
</RadioGroup>
<CheckboxGroup v-else-if="item.questionType == """ v-model="answerInfo[index].multichoice_default">
<Checkbox v-for="(it,i) in item.options" :label="it.id" :key="it.id" :checked.native="item.checked">
<span v-if="it.optionContent.indexOf("-sharpOTHER-sharp") == "-1"">{{it.optionContent}}</span>
<span v-else><Input v-if="it.optionContent.indexOf("-sharpOTHER-sharp") != "-1""></Input></span>
</Checkbox>
</CheckboxGroup>
<Input v-else v-model="item.input_value" type="textarea" :rows="6" placeholder="..."></Input>
</div>
</Row>
data() {
return {
questionId:"",
questionDetail: {},
questions: [],
singlechoice_default: "",
multichoice_default:[],
answerInfo: [],
};
},
created() {
this.getQuestionDetail();
},
getQuestionDetail() {
this.$get("course/list.json",{
courseId: this.$route.query.id
},response => {
this.questionDetail = response.data[0];
this.questionId = response.data[0].questionId;
this.getDetail(this.questionId);
}
);
},
getDetail(questionid) {
this.$get("info/list.json",{
questionid: questionid
},response => {
response.data.forEach((item,index,arr) => {
if (item.questionType === "") {
item.multichoice_default = this.multichoice_default;
} else if (item.questionType === "") {
item.singlechoice_default = this.singlechoice_default;
} else {
}
});
this.answerInfo = response.data;
this.questions = response.data;
}
);
},
}
vue novice, ask for your advice.
how do I get the selected data and submit it?