<template>
  <div>
    <div>
      <span>题干：</span><input type="text" v-model="title">
    </div>
    <div>
      <span>答案：</span><input type="text" v-model="key">
    </div>
    <Button @click="add">提交</Button>
  </div>
</template>
<script>
export default {
  data(){
    return {
      title:"",
      key:""
    }
  },
  methods:{
    add(){
      var title=this.title;
      if(!title){
        this.$Message.warning('请输入题干内容');
        return;
      }
      var key=this.key;
      if(!key){
        this.$Message.warning('请输入答案内容');
        return;
      }
      var exercise={
        title,
        key
      }
      this.$emit('exercise',exercise);
    }
  }
}
</script>