77 @mouseleave =" highlightPostStore.unset()"
88 :current =" currentDateTime" :relativeTo =" previousDateTime"
99 :relativeToText =" `相对于上一${postType}${timestampType}`"
10- :postType =" props.postType" :timestampType =" timestampType" v-bind =" $attrs" >
11- <!-- https://github.com/vuejs/language-tools/issues/4798 -->
10+ :postType =" postType" :timestampType =" timestampType" v-bind =" $attrs" >
1211 <FontAwesome :icon =" faChevronUp" class =" me-1 align-bottom" />
1312 </PostBadgeTimeView >
1413 <PostBadgeTimeView
1817 @mouseleave =" highlightPostStore.unset()"
1918 :current =" currentDateTime" :relativeTo =" nextDateTime"
2019 :relativeToText =" `相对于下一${postType}${timestampType}`"
21- :postType =" props. postType" :timestampType =" timestampType" v-bind =" $attrs" >
20+ :postType =" postType" :timestampType =" timestampType" v-bind =" $attrs" >
2221 <FontAwesome :icon =" faChevronDown" class =" me-1 align-bottom" />
2322 </PostBadgeTimeView >
2423 <PostBadgeTimeView
2928 @mouseleave =" highlightPostStore.unset()"
3029 :current =" currentDateTime" :relativeTo =" parentDateTime"
3130 :relativeToText =" `相对于所属${postTypeText[postTypeText.indexOf(postType) - 1]}${timestampType}`"
32- :postType =" props. postType" :timestampType =" timestampType" v-bind =" $attrs" >
31+ :postType =" postType" :timestampType =" timestampType" v-bind =" $attrs" >
3332 <FontAwesome :icon =" faAnglesUp" class =" me-1 align-bottom" />
3433 </PostBadgeTimeView >
3534</ClientOnly >
3635<PostBadgeTimeView
37- :current =" currentDateTime" :postType =" props. postType"
36+ :current =" currentDateTime" :postType =" postType"
3837 :timestampType =" timestampType" class =" text-end"
3938 :class =" { 'post-badge-time-current-full': hydrationStore.isHydratingOrSSR }" v-bind =" $attrs" />
4039</template >
@@ -54,7 +53,17 @@ import { faAnglesUp, faChevronDown, faChevronUp } from '@fortawesome/free-solid-
5453import { DateTime } from ' luxon' ;
5554
5655defineOptions ({ inheritAttrs: false });
57- const props = defineProps <{
56+ const {
57+ previousPost,
58+ nextPost,
59+ currentPost,
60+ currentPostIDKey,
61+ parentPost,
62+ parentPostIDKey,
63+ postType,
64+ postTimeKey,
65+ timestampType
66+ } = defineProps <{
5867 previousPost? : TPost ,
5968 nextPost? : TPost ,
6069 currentPost: TPost ,
@@ -78,12 +87,12 @@ useNoScript(`<style>
7887// https://github.com/typescript-eslint/typescript-eslint/issues/9723
7988// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents, @typescript-eslint/no-unnecessary-type-parameters
8089const getPostTime = <T extends TPost | TParentPost >(post ? : T ) =>
81- post ?.[props . postTimeKey as keyof T ] as TPostTimeValue | undefined ;
82- const previousTime = computed (() => getPostTime (props . previousPost ));
83- const nextTime = computed (() => getPostTime (props . nextPost ));
84- const parentTime = computed (() => getPostTime (props . parentPost ));
90+ post ?.[postTimeKey as keyof T ] as TPostTimeValue | undefined ;
91+ const previousTime = computed (() => getPostTime (previousPost ));
92+ const nextTime = computed (() => getPostTime (nextPost ));
93+ const parentTime = computed (() => getPostTime (parentPost ));
8594// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
86- const currentTime = computed (() => getPostTime (props . currentPost )! );
95+ const currentTime = computed (() => getPostTime (currentPost )! );
8796
8897const previousDateTime = computed (() =>
8998 undefinedOr (previousTime .value , i => DateTime .fromSeconds (i )));
0 commit comments