<template>
  <div class="radio">
    <div class="left">
      <h3>单选题</h3>
      <div
        class="header"
        v-html="Data.content"
      >
      </div>
      <div class="body">
        <p>正确答案：</p>
        <Radio
          :Disabled="true"
          :Data="Data.value"
          :Value="value"
          @Func="Success"
        />
        <p>选中答案：</p>
        <Radio
          :Disabled="true"
          :state="true"
          :Data="Data.values"
          :Value="values"
          @Func="Successs"
        />
      </div>
    </div>
    <div
      v-if="State"
      class="right"
    >
      <div class="header">{{Data.header}}</div>
      <div class="body"><span style="font-weight:bold;">解析：</span>
        <div class="desc">{{Data.desc}}</div>
      </div>
    </div>
  </div>
</template>
<script>
const Radio = () => import("@/components/Radio/index");
export default {
  components: { Radio },
  props: {
    //状态  答题 查看答案
    State: {
      type: Boolean,
      default: false
    },
    // 题
    // {content:"富文本",result:{no:"做题答案",yes:"正确答案"},type:"radio",value:[{key:'A',label:'公园'}]}
    Data: {
      type: Object,
      default: {}
    }
  },
  data () {
    return {
      value: [],
      values: [],
    }
  },
  methods: {
    // 获取选择的值
    Success (data) {
      this.value = data;
      this.$emit("Func", data);
    },
    Successs (data) {
      this.values = data;
      this.$emit("Func", data);
    }
  },
}
</script>
<style lang="less" scoped>
.radio {
  display: flex;
  .left {
    width: 100%;
    h3 {
      margin-top: 0;
    }
    .body {
      margin: 15px 0;
    }
  }
  .right {
    width: 400px;
    background-color: #f4f7ed;
    .header {
      padding: 10px;
      line-height: 20px;
      border-bottom: 1px solid #fff;
    }
    .body {
      padding: 10px;
      .desc {
        margin-top: 10px;
        width: 100%;
        height: 100%;
        line-height: 24px;
      }
    }
  }
}
</style>