<!--共用选择题-->
<style>
  .sharingChooseQuestion {
    width: 100%;
  }

  .B-info {
    font-size: 14PX;
    color: #A8A8B3;
    padding-bottom: 10px;
    margin-left: 13px;
  }

</style>
<template>
  <div class="sharingChooseQuestion">
    <table v-if="data&&data.length>0" class="common_TiTable">
      <thead>
        <tr>
          <th colspan="2" style="text-align:left;">
            <template v-if="data[1]&& data[1].length>0">
              (1)-({{data[1].length}})题共用备选答案：
            </template>
          </th>
        </tr>
      </thead>
      <tr v-for="(item,index) in data[0]">
        <td style="width:40px;text-align:center; ">
          {{item.Name}}
        </td>
        <td>
          <div v-html="item.Content"></div>
        </td>
      </tr>
    </table>
    <table v-if="data&&data.length>0" class="common_TiTable">
      <tbody v-for="(item,index) in data[1]">
        <tr>
          <td style="width:40px;text-align:center;">
            ({{index+1}})
          </td>
          <td>
            <div v-html="item.Content"></div>
          </td>
        </tr>
        <tr>
          <td>
          </td>
          <td>
            答案: {{data[1][index].Name}}
          </td>
        </tr>
      </tbody>
    </table>
  </div>
</template>
<script>
  export default {
    props: {
      questionData: {
        type: Array,
      },
      setOption: {
        type: Object
      }
    },
    components: {

    },
    data() {
      return {
        data: this.questionData,
      };
    },
    created() {

    },
    methods: {
      //返回数据到父组件
      returnDataToParent() {
        this.$emit('getChild', this.data);
      },
      getAnswer() {
        this.setOption.Answer = "";
        if (this.data && this.data.length > 1) {
          var answer = "";
          this.data[1].forEach(item => {
            answer += "," + item.Name;
          })
          if (answer != "") {
            answer = answer.substring(1);
          }
          this.setOption.Answer = answer;
        }
      },
    },
    mounted() {

    },
    watch: {
      data: {
        handler(newValue) {
          this.setOption.Title = this.data[1][0].Content;
          this.returnDataToParent();
        },
        deep: true
      },
    }
  };

</script>
