forked from cuixueshe/earthworm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.vue
42 lines (36 loc) · 1.17 KB
/
index.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<template>
<div class="flex w-full flex-col">
<h2 class="mb-4 text-2xl font-bold">多课程包</h2>
<template v-if="isLoading">
<Loading></Loading>
</template>
<template v-else>
<div class="h-[79vh] overflow-y-auto overflow-x-hidden scrollbar-hide">
<div
class="grid grid-cols-1 justify-items-center gap-4 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4"
>
<template v-for="coursePack in coursePackStore.coursePacks">
<CoursePackCard :coursePack="coursePack"></CoursePackCard>
</template>
</div>
</div>
</template>
</div>
</template>
<script setup lang="ts">
import { ref } from "vue";
import CoursePackCard from "~/components/courses/CoursePackCard.vue";
import { useCoursePackStore } from "~/store/coursePack";
const coursePackStore = useCoursePackStore();
const isLoading = ref(false);
setup();
async function setup() {
// 课程包不会更新 所以初始化的时候只拉取一次数据就好了
if (coursePackStore.coursePacks.length === 0) {
isLoading.value = true;
await coursePackStore.setupCoursePacks();
isLoading.value = false;
}
}
</script>
<style></style>