<template>
  <section class="box">
    <knowledge-Train
      v-if="currentStep === 0"
      @next="nextStep"
    />
    <knowledge-Train-Answer
      v-if="currentStep === 1"
      @finish-task="finishTask"
    />
  </section>
</template>

<script>
import KnowledgeTrain from './KnowledgeTrain.vue';
import KnowledgeTrainAnswer from './KnowledgeTrainAnswer.vue';
export default {
  components: {
    'knowledge-Train': KnowledgeTrain,
    'knowledge-Train-Answer': KnowledgeTrainAnswer,
  },

  // 定义抛出的事件名称
  emits: ['finishTask'],

  data:function(){
    return{
      currentStep: 0,
    };
  },

  methods: {
    nextStep:function(){
      this.currentStep++;
    },

    finishTask:function(){
      this.$emit('finishTask');
    },
  },
};
</script>