mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
1. 新增首页首屏banner;2. 首页首屏个人信息;3. 新增文章列表banner;4. 更新backToTOP 新增首页大图banner 首页首屏首屏个人信息 文章列表新增文章列表banner 更新backToTop按钮样式;
60 lines
1.5 KiB
Vue
60 lines
1.5 KiB
Vue
<script lang="ts" setup>
|
|
import DropdownTransition from '@theme-plume/DropdownTransition.vue'
|
|
import type { PropType } from 'vue'
|
|
import { useRouter } from 'vue-router'
|
|
import type { PostItem } from '../../shared'
|
|
import AutoLink from './AutoLink.vue'
|
|
import { TopIcon } from './icons'
|
|
import PostMeta from './PostMeta.vue'
|
|
|
|
defineProps({
|
|
post: {
|
|
type: Object as PropType<PostItem>,
|
|
required: true,
|
|
},
|
|
index: {
|
|
type: Number,
|
|
default: 0,
|
|
},
|
|
})
|
|
|
|
const router = useRouter()
|
|
|
|
const handlePost = (path: string): void => {
|
|
router.push({ path })
|
|
}
|
|
</script>
|
|
<template>
|
|
<DropdownTransition :delay="index * 0.04">
|
|
<section :key="post.path" class="post-list-item">
|
|
<div>
|
|
<TopIcon v-if="post.sticky" />
|
|
<div
|
|
v-if="post.banner"
|
|
class="post-banner"
|
|
@click="handlePost(post.path)"
|
|
>
|
|
<div
|
|
:style="{
|
|
'background-image': `url(${post.banner})`,
|
|
}"
|
|
></div>
|
|
</div>
|
|
<h3>
|
|
<AutoLink :item="{ text: post.title, link: post.path }" />
|
|
</h3>
|
|
<PostMeta :post="post" />
|
|
<!--eslint-disable vue/no-v-html-->
|
|
<div
|
|
v-if="post.excerpt"
|
|
class="post-excerpt"
|
|
v-html="post.excerpt"
|
|
></div>
|
|
<div v-if="post.excerpt" class="post-more">
|
|
<AutoLink :item="{ text: '阅读全文', link: post.path }" />
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</DropdownTransition>
|
|
</template>
|