自己写的效果样子
故意点错误的答案,再点提交之后 效果图
我现在不会弄两个class
怎么判断答案和选中的
然后分别把两个正确状态和错误状态一并显示出来
//不知道为什么大家好像没有看到demo给的链接,我就甩出下面的代码来。
Document* {
margin: 0;
padding: 0;
}
.scroll-wrap {
width: 200px;
border: 1px solid blue;
overflow: hidden;
}
.scroll-content {
position: relative;
transition: top 0.5s;
}
.scroll-content li {
line-height: 50px;
text-align: center;
}
.active {
border: 1px solid #ddd;
}
.Right{
border:1px solid red;
}
.Error{
border:1px solid #4ac291;
}
【{{duoxuan[types-1]}}】
剩余答题时间:
60
{{titleexam}}
/>{{item.answer}}
{{item.answer}}
{{item}}
提交
var result = { "code": 100, "message": "操作成功", "data": { "isRight": 0, "answer": [{ "score": 0, "answer": "悲观厌世", "id": 27749 }, { "score": 0, "answer": "出现幻觉、妄想", "id": 27750 }, { "score": 0, "answer": "有自杀企图或行为", "id": 27751 }, { "score": 1, "answer": "兴趣狭窄", "id": 27752 }], "id": 127, "title": "自闭症患者主要表现为不同程度的言语发育障碍、人际交往障碍、行为方式刻板和( )几方面。", "type": 1 } }
new Vue({
el: "#example",
data: {
answer: '',
duoxuan: ['单选题', '多选题', '判断题'],
rightlist: ['正确', '错误'],
types: '',
titleexam: '',
examId: '',
checkQues: {},
},
created: function () {
var self = this;
console.log(result.data);
self.titleexam = result.data.title;
self.answer = result.data.answer;
self.types = result.data.type;
self.examId = result.data.id;
self.types = result.data.type;
},
methods: {
alocked: function (item, check, id, pageid) { //单选题
this.checkQues[id] = '' + check + ''; //已答题的区集
},
checkeds: function (items, check, id, pageid) { //多选题
var checkListDate = this.checkList;
var check = check.toString();
if (this.checkList.indexOf(check) > -1) {
let index = this.checkList.indexOf(check)
this.checkList.splice(index, 1)
var duoid = this.checkList.join();
if (duoid == "") {
}
this.checkQues[id] = '' + duoid + ''; //已答题的区集
} else {
this.checkList.push(check);
var duoid = this.checkList.join();
this.checkQues[id] = '' + duoid + ''; //已答题的区集
}
},
judgment: function (item, check, pageid) { //判断题
if (item == 0) {
this.checkQues[pageid] = 1; //已答题的区集
} else {
this.checkQues[pageid] = 0; //已答题的区集
}
},
}
})