吴雨瞳添加了注释

master
wyt 6 months ago
parent 062308d61c
commit 4b7924fbc1

@ -1,25 +1,48 @@
<template>
<!-- 特色内容列表容器
- 应用网格布局内边距间距和盒模型样式
-->
<div class="inverted-main-grid py-8 gap-8 box-border">
<!-- 特色内容标题区域
- 相对定位溢出隐藏固定高度响应式调整圆角和阴影样式
-->
<div class="relative overflow-hidden h-56 lg:h-auto rounded-2xl bg-ob-deep-800 shadow-lg">
<!-- 标题渐变遮罩层
- 应用渐变背景透明度定位内边距和阴影样式
- 内容水平左对齐垂直底部对齐
-->
<div
class="ob-gradient-plate opacity-90 relative z-10 bg-ob-deep-900 rounded-2xl flex justify-start items-end px-8 pb-10 shadow-md">
class="ob-gradient-plate opacity-90 relative z-10 bg-ob-deep-900 rounded-2xl flex justify-start items-end px-8 pb-10 shadow-md">
<h2 class="text-3xl pb-8 lg:pb-16">
<!-- 编辑精选文字应用渐变文本样式 -->
<p :style="gradientText">EDITOR'S SELECTION</p>
<!-- 推荐内容标题
- 包含热门图标和国际化文本
-->
<span class="relative text-2xl text-ob-bright font-semibold">
<svg-icon class="inline-block" icon-class="hot" />
{{ t('home.recommended') }}
</span>
</h2>
</div>
<!-- 背景渐变层
- 绝对定位覆盖整个容器应用主题渐变背景
-->
<span class="absolute top-0 w-full h-full z-0" :style="gradientBackground" />
</div>
<!-- 特色文章列表
- 网格布局大屏幕下2列设置间距
-->
<ul class="grid lg:grid-cols-2 gap-8">
<!-- 有特色文章时渲染 -->
<template v-if="featuredArticles.length > 0">
<li v-for="article in featuredArticles" :key="article.id">
<!-- 文章卡片组件应用特色文章样式 -->
<ArticleCard class="home-featured-article" :data="article" />
</li>
</template>
<!-- 无特色文章时显示2个空卡片占位 -->
<template v-else>
<li v-for="n in 2" :key="n">
<ArticleCard :data="{}" />
@ -30,28 +53,42 @@
</template>
<script lang="ts">
// @ts-nocheck
// @ts-nocheck TypeScript
//
import { useAppStore } from '@/stores/app'
//
import { useArticleStore } from '@/stores/article'
//
import { useI18n } from 'vue-i18n'
// VueAPI
import { computed, defineComponent, toRef } from 'vue'
//
import { ArticleCard } from '@/components/ArticleCard'
// FeatureList
export default defineComponent({
name: 'FeatureList',
name: 'FeatureList', //
components: {
ArticleCard
ArticleCard //
},
setup() {
//
const appStore = useAppStore()
//
const articleStore = useArticleStore()
//
const { t } = useI18n()
return {
//
gradientBackground: computed(() => {
return { background: appStore.themeConfig.header_gradient_css }
}),
//
gradientText: appStore.themeConfig.background_gradient_style,
//
featuredArticles: toRef(articleStore.$state, 'featuredArticles'),
//
t
}
}
@ -59,9 +96,11 @@ export default defineComponent({
</script>
<style lang="scss">
//
.home-featured-article {
.article-content {
p {
// 4
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
@ -69,8 +108,9 @@ export default defineComponent({
-webkit-box-orient: vertical;
}
.article-footer {
//
margin-top: 13px;
}
}
}
</style>
</style>
Loading…
Cancel
Save