|
@@ -6,8 +6,8 @@
|
|
|
<div class="title">{{ `(${option[checkJson.type].name})` + checkJson.title }}</div>
|
|
|
<div class="choices">
|
|
|
<div class="choice" v-for="(item, index) in checkJson.array" :key="index">
|
|
|
- <div class="choice_c" v-if="checkJson.type == 2"><el-checkbox v-model="checkJson.answer2" :label="index"></el-checkbox><span>{{ item.option }}</span></div>
|
|
|
- <div class="choice_c" v-if="checkJson.type == 1"><el-radio v-model="checkJson.answer2[0]" :label="index"></el-radio><span>{{ item.option }}</span></div>
|
|
|
+ <div class="choice_c" v-if="checkJson.type == 2"><el-checkbox v-model="checkJson.answer2" :label="index"></el-checkbox><span @click="check(checkJson.type,index)">{{ item.option }}</span></div>
|
|
|
+ <div class="choice_c" v-if="checkJson.type == 1"><el-radio v-model="checkJson.answer2[0]" :label="index"></el-radio><span @click="check(checkJson.type,index)">{{ item.option }}</span></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -42,6 +42,18 @@ export default {
|
|
|
depthCopy(s) {
|
|
|
return JSON.parse(JSON.stringify(s));
|
|
|
},
|
|
|
+ check(type,index){
|
|
|
+ if(type == 2){
|
|
|
+ if(this.checkJson.answer2.indexOf(index) == -1){
|
|
|
+ this.checkJson.answer2.push(index)
|
|
|
+ }else{
|
|
|
+ this.checkJson.answer2.splice(this.checkJson.answer2.indexOf(index),1)
|
|
|
+ }
|
|
|
+ }else if(type == 1){
|
|
|
+ this.checkJson.answer2[0] = index
|
|
|
+ }
|
|
|
+ this.$forceUpdate()
|
|
|
+ }
|
|
|
},
|
|
|
mounted(){
|
|
|
this.checkJson = this.cJson ? this.depthCopy(this.cJson) : undefined
|
|
@@ -84,6 +96,7 @@ export default {
|
|
|
}
|
|
|
.choice_box>.choices >.choice > .choice_c > span{
|
|
|
/* margin-left: 10px; */
|
|
|
+ cursor: pointer;
|
|
|
}
|
|
|
.choice_box>.choices >.choice > .choice_c > .el-checkbox{
|
|
|
margin-top: 4px;
|