-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #116 from Justin3go/preview
Preview
- Loading branch information
Showing
16 changed files
with
276 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
--- | ||
# https://vitepress.dev/reference/default-theme-home-page | ||
layout: doc | ||
editLink: false | ||
lastUpdated: false | ||
isNoComment: true | ||
isNoBackBtn: true | ||
--- | ||
|
||
<!-- 之所以将代码写在 md 里面,而非单独封装为 Vue 组件,因为 aside 不会动态刷新,参考 https://github.com/vuejs/vitepress/issues/2686 --> | ||
<template v-for="[year, postGroup] in postGroups" :key="year"> | ||
<h2 :id="year" class="post-title"> | ||
<a | ||
class="header-anchor" | ||
:href="`#${year}`" | ||
:aria-label="`Permalink to "${year}"`" | ||
></a | ||
> | ||
<div class="post-year hollow-text">{{ year }}</div> | ||
</h2> | ||
<div class="post-container" v-for="post in postGroup" :key="post.url"> | ||
<a :href="post.url">{{ post.title }}</a> | ||
<span class="post-date"> | ||
{{ post.date.monthDay }} | ||
</span> | ||
</div> | ||
</template> | ||
|
||
|
||
<script lang="ts" setup> | ||
import { ref, computed } from "vue"; | ||
// 非 Vue 组件需要手动引入 | ||
import { | ||
MessagePlugin, | ||
PaginationProps, | ||
Pagination as TPagination, | ||
Tag as TTag, | ||
} from "tdesign-vue-next"; | ||
import { TimeIcon } from "tdesign-icons-vue-next"; | ||
|
||
import { data as posts } from "./.vitepress/theme/posts.data.mts"; | ||
import { isMobile } from "./.vitepress/theme/utils/mobile.ts"; | ||
|
||
const postGroups = computed(() => { | ||
const groups = new Map<string, typeof posts>(); | ||
posts.forEach((post) => { | ||
const year = post.date.year; | ||
if (!groups.has(year)) { | ||
groups.set(year, []); | ||
} | ||
groups.get(year)?.push(post); | ||
}); | ||
return groups; | ||
}); | ||
|
||
console.log('postGroups', postGroups.value); | ||
</script> | ||
<style lang="scss" scoped> | ||
|
||
.mr-2 { | ||
margin-right: 2px; | ||
} | ||
|
||
.post-title { | ||
margin-bottom: 6px; | ||
border-top: 0px; | ||
position: relative; | ||
top: 0; | ||
left: 0; | ||
|
||
.post-year { | ||
position: absolute; | ||
top: -6px; | ||
left: -10px; | ||
|
||
z-index: -1; | ||
opacity: .12; | ||
font-size: 86px; | ||
font-weight: 900; | ||
} | ||
} | ||
|
||
.post-container { | ||
display: flex; | ||
justify-content: space-between; | ||
margin: 12px 0; | ||
|
||
.post-date { | ||
opacity: .6; | ||
} | ||
} | ||
|
||
.hollow-text { | ||
|
||
/* 设置文本颜色为透明 */ | ||
color: var(--vp-c-bg); | ||
|
||
-webkit-text-stroke: 1px var(--vp-c-text-1); | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
--- | ||
# https://vitepress.dev/reference/default-theme-home-page | ||
layout: doc | ||
editLink: false | ||
lastUpdated: false | ||
isNoComment: true | ||
isNoBackBtn: true | ||
--- | ||
|
||
<!-- 之所以将代码写在 md 里面,而非单独封装为 Vue 组件,因为 aside 不会动态刷新,参考 https://github.com/vuejs/vitepress/issues/2686 --> | ||
<template v-for="[year, postGroup] in postGroups" :key="year"> | ||
<h2 :id="year" class="post-title"> | ||
<a | ||
class="header-anchor" | ||
:href="`#${year}`" | ||
:aria-label="`Permalink to "${year}"`" | ||
></a | ||
> | ||
<div class="post-year hollow-text">{{ year }}</div> | ||
</h2> | ||
<div class="post-container" v-for="post in postGroup" :key="post.url"> | ||
<a :href="post.url">{{ post.title }}</a> | ||
<span class="post-date"> | ||
{{ post.date.monthDay }} | ||
</span> | ||
</div> | ||
</template> | ||
|
||
|
||
<script lang="ts" setup> | ||
import { ref, computed } from "vue"; | ||
// 非 Vue 组件需要手动引入 | ||
import { | ||
MessagePlugin, | ||
PaginationProps, | ||
Pagination as TPagination, | ||
Tag as TTag, | ||
} from "tdesign-vue-next"; | ||
import { TimeIcon } from "tdesign-icons-vue-next"; | ||
|
||
import { data as posts } from "../.vitepress/theme/posts-en.data.mts"; | ||
import { isMobile } from "../.vitepress/theme/utils/mobile.ts"; | ||
|
||
const postGroups = computed(() => { | ||
const groups = new Map<string, typeof posts>(); | ||
posts.forEach((post) => { | ||
const year = post.date.year; | ||
if (!groups.has(year)) { | ||
groups.set(year, []); | ||
} | ||
groups.get(year)?.push(post); | ||
}); | ||
return groups; | ||
}); | ||
|
||
console.log('postGroups', postGroups.value); | ||
</script> | ||
<style lang="scss" scoped> | ||
|
||
.mr-2 { | ||
margin-right: 2px; | ||
} | ||
|
||
.post-title { | ||
margin-bottom: 6px; | ||
border-top: 0px; | ||
position: relative; | ||
top: 0; | ||
left: 0; | ||
|
||
.post-year { | ||
position: absolute; | ||
top: -6px; | ||
left: -10px; | ||
|
||
z-index: -1; | ||
opacity: .12; | ||
font-size: 86px; | ||
font-weight: 900; | ||
} | ||
} | ||
|
||
.post-container { | ||
display: flex; | ||
justify-content: space-between; | ||
margin: 12px 0; | ||
|
||
.post-date { | ||
opacity: .6; | ||
} | ||
} | ||
|
||
.hollow-text { | ||
|
||
/* 设置文本颜色为透明 */ | ||
color: var(--vp-c-bg); | ||
|
||
-webkit-text-stroke: 1px var(--vp-c-text-1); | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.