✨ 主页添加絮语卡片 归档部分初见雏形
This commit is contained in:
+29
-40
@@ -1,57 +1,46 @@
|
||||
<script setup lang="ts">
|
||||
|
||||
import { toArticleMetaDataType } from '~/types/ArticleMetaData';
|
||||
import { toMetaDataType } from '~/types/PostMetaData';
|
||||
import RamblingCard from '~/pages/index/components/RamblingCard.vue';
|
||||
import ArticleCard from '~/pages/index/components/ArticleCard.vue';
|
||||
|
||||
const { data: articles } = useAsyncData(async () => await queryCollection('content').all());
|
||||
const { data: posts } = useAsyncData(async () => await queryCollection('content').order('published_at', 'DESC').all());
|
||||
|
||||
onMounted(() => {
|
||||
console.log(articles.value);
|
||||
});
|
||||
|
||||
// // 监听断点变化并设置延迟策略
|
||||
// watch(showLeftDetailInfo, (newValue, oldValue) => {
|
||||
// if (newValue && !oldValue) {
|
||||
// // xl -> 2xl (显示) - 需要延迟
|
||||
// shouldDelay.value = true;
|
||||
// isTransitioning.value = true;
|
||||
// } else if (!newValue && oldValue) {
|
||||
// // 2xl -> xl (隐藏) - 不延迟
|
||||
// shouldDelay.value = false;
|
||||
// isTransitioning.value = true;
|
||||
// }
|
||||
//
|
||||
// // 动画完成后重置状态
|
||||
// onMounted(() => {
|
||||
// setTimeout(() => {
|
||||
// isTransitioning.value = false;
|
||||
// }, 400); // 根据你的动画时长调整
|
||||
// console.log(articles.value);
|
||||
// }, 2000);
|
||||
// });
|
||||
type PostItem = NonNullable<typeof posts.value>[number];
|
||||
|
||||
function toArticlePage(article: PostItem) {
|
||||
navigateTo(`/article/${encodeURIComponent(article.id)}`);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div class="mt-4">
|
||||
<div class="table w-full">
|
||||
<div class="sticky top-16 float-left bg-old-neutral-500 h-[100vh]">
|
||||
<div class="relative duration-500 transition-all xl:w-80 w-0 mr-2/3 h-full overflow-hidden">
|
||||
<div class="absolute top-0 left-0 w-80 text-white z-50">
|
||||
<div class="">
|
||||
test123456
|
||||
</div>
|
||||
</div>
|
||||
<div class="table w-full mt-6">
|
||||
<div class="sticky top-16 float-left bg-old-neutral-200 dark:bg-old-neutral-800 max-h-[calc(100vh-4rem)]">
|
||||
<div class="relative duration-500 transition-all xl:w-80 w-0 mr-2/3 overflow-hidden">
|
||||
<div class="w-80 top-0 left-0 text-gray-800 dark:text-white p-5">
|
||||
test123456
|
||||
</div>
|
||||
</div>
|
||||
<div class="transition-all duration-500 float-right xl:w-[calc(100%-20rem-40px)] w-full">
|
||||
<ArticleCard
|
||||
v-for="article in articles" :key="article.id"
|
||||
class="mb-4 w-full"
|
||||
:article="toArticleMetaDataType(article)"/>
|
||||
<ArticleCard/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
test
|
||||
<div class="transition-all duration-500 float-right xl:w-[calc(100%-20rem-40px)] w-full">
|
||||
<ArticleCard class="mb-6 w-full transition-shadow duration-300 shadow-lg hover:shadow-old-neutral-600"/>
|
||||
<div v-for="article in posts" :key="article.id" class="mb-6 w-full transition-shadow duration-300 shadow-lg hover:shadow-old-neutral-600 hover:cursor-pointer">
|
||||
<ArticleCard
|
||||
v-if="!article.draft && article.type === 'article'"
|
||||
:article="toMetaDataType(article)"
|
||||
@click="toArticlePage(article)"/>
|
||||
<RamblingCard
|
||||
v-else-if="!article.draft && article.type === 'rambling'"
|
||||
:rambling="toMetaDataType(article)"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user