<template>
    <el-dialog
      append-to-body
      v-if="dialogVisible"
      title="选择自选专业"
      :visible.sync="dialogVisible"
      :before-close="handlerClose"
      :close-on-click-modal ="false"
      width="70%"
    >
      <subject-choice :course0="course0" :course1="course1" :year="year" ></subject-choice>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="cancel">确 定</el-button>
      </span>
    </el-dialog>
</template>
<script>
import SubjectChoice from'@/views/career/subject/subjectChoice'
export default {
  components: {
    SubjectChoice
  },
  inject: ['optionalMajors'],
  data() {
    return{
      dialogVisible:false,
      course0: '',
      year: '',
      course1: '',
    }
  },
  methods: {
    handlerClose() {
      console.log('res')
      this.cancel()
    },
    open(course0, course1,year) {
      this.dialogVisible = true
      this.year = year || ''
      this.course0 = course0
      this.course1 = course1
    },
    cancel() {
      this.dialogVisible = false
      this.optionalMajors()
    }
  }
}
</script>
<style scoped>
</style>
