CourseCard.vue 1.05 KB
<template>
  <router-link :to="`/courses/${course.id}`" class="flex bg-white rounded-lg overflow-hidden shadow-sm">
    <div class="w-1/3 h-28">
      <img
        :src="course.imageUrl"
        :alt="course.title"
        class="w-full h-full object-cover"
      />
    </div>
    <div class="flex-1 p-3 flex flex-col justify-between">
      <div>
        <h3 class="font-medium text-sm mb-1 line-clamp-2">{{ course.title }}</h3>
        <div class="text-gray-500 text-xs">{{ course.subtitle }}</div>
      </div>
      <div class="flex justify-between items-end mt-1">
        <div class="text-orange-500 font-semibold">¥{{ course.price }}</div>
        <div class="text-gray-400 text-xs">
          {{ course.subscribers }}人订阅
        </div>
      </div>
      <div class="text-gray-400 text-xs">
        已更新{{ course.updatedLessons }}期 | {{ course.subscribers }}人订阅
      </div>
    </div>
  </router-link>
</template>

<script setup>
import { defineProps } from 'vue'

defineProps({
  course: {
    type: Object,
    required: true
  }
})
</script>