mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-05-31 05:10:45 +08:00
重构 credits.vue 和 media.vue 组件,简化 API 路径处理,移除不必要的路由参数,同时优化 PersonCardListView 组件的样式。
This commit is contained in:
@@ -1,24 +1,28 @@
|
||||
<script setup lang="ts">
|
||||
import PersonCardListView from '@/views/discover/PersonCardListView.vue'
|
||||
|
||||
// 输入参数
|
||||
const props = defineProps({
|
||||
// API路径
|
||||
paths: Array as PropType<string[]> | PropType<string>,
|
||||
})
|
||||
|
||||
// 路由参数
|
||||
const route = useRoute()
|
||||
const id = route.query?.id?.toString()
|
||||
const title = route.query?.title?.toString()
|
||||
const source = route.query?.source?.toString()
|
||||
const type = route.query?.type?.toString()
|
||||
const apipath = route.query?.apipath?.toString()
|
||||
|
||||
// 标题
|
||||
let title = route.query?.title?.toString()
|
||||
|
||||
// 计算API路径
|
||||
function getApiPath(paths: string[] | string) {
|
||||
if (Array.isArray(paths)) return paths.join('/')
|
||||
else return paths
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<VPageContentTitle :title="title" />
|
||||
<PersonCardListView
|
||||
:credits-id="id"
|
||||
:credits-name="title"
|
||||
:credits-source="source"
|
||||
:credits-type="type"
|
||||
:credits-apipath="apipath"
|
||||
/>
|
||||
<PersonCardListView :apipath="getApiPath(props.paths || '')" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -14,12 +14,6 @@ const mediaid = route.query?.mediaid?.toString()
|
||||
// 类型:电影、电视剧
|
||||
const type = route.query?.type?.toString()
|
||||
|
||||
// 媒体信息来源:TMDB、豆瓣
|
||||
const source = route.query?.source?.toString() || 'themoviedb'
|
||||
|
||||
// TMDB ID
|
||||
const page = route.query?.page?.toString() || '1'
|
||||
|
||||
// 标题
|
||||
const title = route.query?.title?.toString()
|
||||
|
||||
@@ -29,6 +23,6 @@ const year = route.query?.year?.toString()
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<MediaDetailView :mediaid="mediaid" :type="type" :source="source" :page="page" :title="title" :year="year" />
|
||||
<MediaDetailView :mediaid="mediaid" :type="type" :title="title" :year="year" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user