mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 15:36:49 +08:00
es lint fix
This commit is contained in:
@@ -1,57 +1,72 @@
|
||||
<script lang="ts" setup>
|
||||
import api from "@/api";
|
||||
import { MediaInfo } from "@/api/types";
|
||||
import MediaCard from "@/components/cards/MediaCard.vue";
|
||||
import api from '@/api'
|
||||
import type { MediaInfo } from '@/api/types'
|
||||
import MediaCard from '@/components/cards/MediaCard.vue'
|
||||
|
||||
// 输入参数
|
||||
const props = defineProps({
|
||||
apipath: String,
|
||||
});
|
||||
})
|
||||
|
||||
// 组件加载完成
|
||||
const componentLoaded = ref(false);
|
||||
const componentLoaded = ref(false)
|
||||
|
||||
// 数据列表
|
||||
const dataList = ref<MediaInfo[]>([]);
|
||||
const dataList = ref<MediaInfo[]>([])
|
||||
|
||||
// 获取订阅列表数据
|
||||
const fetchData = async () => {
|
||||
async function fetchData() {
|
||||
try {
|
||||
if (!props.apipath) {
|
||||
return;
|
||||
}
|
||||
dataList.value = await api.get(props.apipath);
|
||||
componentLoaded.value = true;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
if (!props.apipath)
|
||||
return
|
||||
|
||||
dataList.value = await api.get(props.apipath)
|
||||
componentLoaded.value = true
|
||||
}
|
||||
};
|
||||
catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
|
||||
// 加载时获取数据
|
||||
onMounted(fetchData);
|
||||
onMounted(fetchData)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<slot name="title" :loaded="componentLoaded"></slot>
|
||||
<slot
|
||||
name="title"
|
||||
:loaded="componentLoaded"
|
||||
/>
|
||||
<VSlideGroup show-arrows="false">
|
||||
<template #prev>
|
||||
<VBtn class="rounded-circle shadow-none" icon="mdi-chevron-left" color="grey" />
|
||||
<VBtn
|
||||
class="rounded-circle shadow-none"
|
||||
icon="mdi-chevron-left"
|
||||
color="grey"
|
||||
/>
|
||||
</template>
|
||||
<VSlideGroupItem v-for="data in dataList" :key="data.tmdb_id">
|
||||
<VSlideGroupItem
|
||||
v-for="data in dataList"
|
||||
:key="data.tmdb_id"
|
||||
>
|
||||
<MediaCard
|
||||
:key="data.tmdb_id || data.douban_id"
|
||||
:media="data"
|
||||
height="15rem"
|
||||
width="10rem"
|
||||
:key="data.tmdb_id || data.douban_id"
|
||||
/>
|
||||
</VSlideGroupItem>
|
||||
<template #next>
|
||||
<VBtn class="rounded-circle shadow-none" icon="mdi-chevron-right" color="grey" />
|
||||
<VBtn
|
||||
class="rounded-circle shadow-none"
|
||||
icon="mdi-chevron-right"
|
||||
color="grey"
|
||||
/>
|
||||
</template>
|
||||
</VSlideGroup>
|
||||
</template>
|
||||
|
||||
<style type="scss">
|
||||
<style lang="scss">
|
||||
.v-slide-group .v-card {
|
||||
@apply m-2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user