11<script setup lang="ts">
22import type { uni } from ' @delta-comic/model'
33import { useQuery } from ' @pinia/colada'
4+ import { KeyboardArrowDownRound } from ' @vicons/material'
45import { createReusableTemplate , useCssVar } from ' @vueuse/core'
6+ import { motion } from ' motion-v'
57import { computed , shallowRef , useTemplateRef } from ' vue'
68
79import Comment from ' @/components/comment/Comment.vue'
8- import ItemCard from ' @/components/ItemCard.vue'
910import { createDateString } from ' @/utils/date'
1011
1112import * as LayoutInject from ' ./default'
13+ import Actions from ' ./default/Actions.vue'
14+ import Description from ' ./default/Description.vue'
15+ import EpController from ' ./default/EpController.vue'
16+ import SubscribeList from ' ./default/SubscribeList.vue'
17+ import Tags from ' ./default/Tags.vue'
18+ import ViewBox from ' ./default/ViewBox.vue'
1219
1320defineSlots <{
1421 subscribeRow(args : LayoutInject .SubscribeRowProps ): any
@@ -35,31 +42,10 @@ const safeHeightTop = computed(() => Number(safeHeightTopCss.value?.match(/\d+/)
3542const isScrolled = shallowRef (false )
3643const scrollbar = useTemplateRef (' scrollbar' )
3744
38- const contentSource = PromiseContent .withResolvers <uni .item .Item >(true )
39- watch (
40- $props .page .union ,
41- union => {
42- if (! union ) return
43- console .log (' resolve' , union )
44- contentSource .resolve (union )
45- },
46- { immediate: true }
47- )
48-
49- $props .page .detail .content .onError (err => {
50- console .error (' resolve catch' , err )
51- contentSource .reset (false )
52- contentSource .reject (err )
45+ const { data : shortId } = useQuery ({
46+ query : ({ signal }) => $props .page .fetchShortId (signal ),
47+ key : () => [LayoutInject .QueryKey .ShortId , LayoutInject .createPageQueryKey ($props .page )]
5348})
54- $props .page .detail .content .onSuccess (data => {
55- console .log (' resolve then' , $props .page .preload .value )
56- contentSource .reset (false )
57- contentSource .resolve (data )
58- })
59-
60- const config = useConfig ()
61-
62- const getActionInfo = (key : string ) => Global .userActions .get ([union .value .$$plugin , key ])!
6349 </script >
6450
6551<template >
@@ -88,7 +74,11 @@ const getActionInfo = (key: string) => Global.userActions.get([union.value.$$plu
8874 : ' var(--nui-body-color)'
8975 } "
9076 >
91- <ViewBox />
77+ <ViewBox :isScrolled :scrollbar >
78+ <template #view >
79+ <slot name =" view" />
80+ </template >
81+ </ViewBox >
9282 <VanTabs
9383 shrink
9484 swipeable
@@ -103,13 +93,8 @@ const getActionInfo = (key: string) => Global.userActions.get([union.value.$$plu
10393 title="简介"
10494 name="info"
10595 >
106- <DcContent
107- :source =" contentSource .content "
108- retriable
109- @reset-retry =" $props .page .reloadAll "
110- class="min-h-[60vh]"
111- >
112- <SubscribeList />
96+ <div class =" min-h-[60vh] w-full" >
97+ <SubscribeList :page :union />
11398 <div class =" mx-auto mt-2 w-[95%]" >
11499 <div class =" relative flex h-fit" >
115100 <div class =" relative w-[89%] text-[17px] font-medium" >
@@ -133,17 +118,19 @@ const getActionInfo = (key: string) => Global.userActions.get([union.value.$$plu
133118 {{ union?.title }}
134119 </span >
135120 <Title />
121+
136122 <div
123+ v-if =" shortId"
137124 class =" mt-0.5 flex justify-start text-xs font-light text-(--van-text-color-2)"
138125 >
139126 <div class =" mr-2" >
140- {{ page.pid.content.data.value }}
127+ {{ shortId }}
141128 </div >
142129 </div >
143130
144- <Description />
131+ <Description : page : union />
145132
146- <Tags />
133+ <Tags : union />
147134 </NCollapseTransition >
148135 </div >
149136 <NIcon
@@ -156,19 +143,23 @@ const getActionInfo = (key: string) => Global.userActions.get([union.value.$$plu
156143 <KeyboardArrowDownRound />
157144 </NIcon >
158145 </div >
159- <Actions />
160- <EpController />
146+ <Actions :page :union >
147+ <template #action =" { item , page } " >
148+ <slot name =" action" :item :page />
149+ </template >
150+ </Actions >
151+ <EpController :page :union :scrollbar />
161152 </div >
162153 <Recommends />
163- </DcContent >
154+ </div >
164155 </VanTab >
165156
166- <VanTab class="van-hairline--top h-full!" title="评论" name="comment">
157+ <VanTab class="van-hairline--top h-full!" title="评论" name="comment" v-if = " union " >
167158 <template #title >
168159 <span >评论</span >
169160 <span class =" ml-0.5 text-xs! font-light" >{{ union?.commentNumber ?? '' }}</span >
170161 </template >
171- <Comment :comments =" page .comments " :item =" union " class="h-[calc(70vh-38px)]" />
162+ <Comment :fetchComments =" page .fetchComments " :item =" union " class="h-[calc(70vh-38px)]" />
172163 </VanTab >
173164
174165 <slot name =" tab" : =" { page }" />
0 commit comments