<template>
  <div class="main-container">
    <course-item v-for="item in courseList" :data="item" :key="item.course_id"></course-item>
  </div>
</template>

<script>
import * as api from '@/api/course.js'
import CourseItem from '@/components/CourseItem.vue'

export default {
  name: 'Course',
  components: { CourseItem },
  metaInfo: {
    title: '课程学习'
  },
  data() {
    return {
      courseList: []
    }
  },
  methods: {
    getCourseList() {
      api.getCourseList().then(response => {
        this.courseList = response
      })
    }
  },
  beforeMount() {
    this.getCourseList()
  }
}
</script>

<style lang="scss">
.course-item:last-child {
  border-bottom: 0;
}
</style>
