<!--判断题-->
<style>

</style>
<template>
  <div class="judgeQuestion">
    <table v-if="data&&data.length>0">
      <tr v-for="(item,index) in data">
        <td>
          <el-checkbox v-model="item.IsAnswer" @change="ChangeItem(item)">{{item.Name}}</el-checkbox>
        </td>
        <td>
          <UeEditor v-model="item.Content" :config="config"></UeEditor>
        </td>
      </tr>
    </table>
  </div>
</template>
<script>
  import UeEditor from '../editor/UeEditor'
  export default {
    props: {
      questionData: {
        type: Array,
      },
      setOption: {
        type: Object,
      }
    },
    components: {
      UeEditor
    },
    data() {
      return {
        data: this.questionData,
        config: {
          initialFrameWidth: null,
          initialFrameHeight: 80,
        },
      };
    },
    created() {},
    methods: {
      //返回数据到父组件
      returnDataToParent() {
        this.$emit('getChild', this.data);
      },
      ChangeItem(item) {
        if (this.data && this.data.length > 0) {
          this.data.forEach(item => {
            item.IsAnswer = false;
          })
        }
        item.IsAnswer = true;
      },
    },
    mounted() {

    },
    watch: {
      data: {
        handler(newValue) {
          this.returnDataToParent();
        },
        deep: true
      },
    }
  };

</script>
