升级:VitePress 版本升级为 v1.0.0-alpha.8

This commit is contained in:
2022-08-18 11:22:44 +08:00
parent a63bc6bc13
commit 4967b49430
12 changed files with 227 additions and 233 deletions

View File

@@ -12,7 +12,7 @@ export const markdown: MarkdownOptions = {
config: (md) => {
md.renderer.rules.heading_close = (tokens, idx, options, env, slf) => {
let htmlResult = slf.renderToken(tokens, idx, options, env, slf)
if (tokens[idx].tag === 'h1') htmlResult += `\n<ArticleMetadata v-if="($frontmatter?.aside ?? true) && ($frontmatter?.showArticleMetadata ?? true)" :article="$frontmatter" />`
if (tokens[idx].tag === 'h1') htmlResult += `\n<ClientOnly><ArticleMetadata v-if="($frontmatter?.aside ?? true) && ($frontmatter?.showArticleMetadata ?? true)" :article="$frontmatter" /></ClientOnly>`
return htmlResult
}
}

View File

@@ -1,7 +1,9 @@
<template>
<Layout>
<template #doc-footer-before>
<Copyright v-if="(frontmatter?.aside ?? true) && (frontmatter?.showArticleMetadata ?? true) && !(frontmatter.authorLink)" :key="md5(page.relativePath)" />
<ClientOnly>
<Copyright v-if="(frontmatter?.aside ?? true) && (frontmatter?.showArticleMetadata ?? true) && !(frontmatter.authorLink)" :key="md5(page.relativePath)" />
</ClientOnly>
</template>
<template #doc-after>
<Comment v-if="(theme.commentConfig?.showComment ?? true) && (frontmatter?.showComment ?? true)" :commentConfig="theme.commentConfig" :key="md5(page.relativePath)" />

View File

@@ -48,7 +48,7 @@ onMounted(() => {
// 如果点赞,先判断有没有登录
let $gc = $('#comment-container');
$gc.on('click', '.gt-comment-like', function () {
if (!localStorage.getItem('GT_ACCESS_TOKEN')) {
if (!window.localStorage.getItem('GT_ACCESS_TOKEN')) {
Message.warning({
content:'点赞前,请您先进行登录',
closable: true

View File

@@ -43,7 +43,7 @@ const { theme, frontmatter } = useData()
const data = reactive({
author: frontmatter.value?.author ?? theme.value.articleMetadataConfig.author,
authorLink: frontmatter.value?.authorLink ?? theme.value.articleMetadataConfig.authorLink,
articleLink: decodeURI(location.href)
articleLink: decodeURI(window.location.href)
})
const { author, authorLink, articleLink } = toRefs(data)
</script>

View File

@@ -1,7 +1,7 @@
<template>
<footer class="VPFooter">
<div class="container">
<p class="recordCode">
<p v-if="theme.footerConfig.icpRecordCode" class="recordCode">
<span class="icon">
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><title>ICP备案号</title><path d="M778.24 163.84c-76.8-40.96-165.888-61.44-269.312-61.44s-192.512 20.48-269.312 61.44h-133.12l23.552 337.92c8.192 113.664 67.584 217.088 162.816 280.576l215.04 144.384 215.04-144.384c96.256-63.488 155.648-166.912 163.84-280.576l23.552-337.92H778.24z m47.104 333.824c-7.168 94.208-56.32 181.248-135.168 233.472l-181.248 120.832L327.68 731.136c-78.848-53.248-129.024-139.264-135.168-233.472L173.056 225.28h136.192v-26.624c58.368-23.552 124.928-34.816 199.68-34.816s141.312 12.288 199.68 34.816V225.28H844.8l-19.456 272.384z"></path><path d="M685.056 328.704v-46.08H455.68c2.048-4.096 6.144-9.216 11.264-15.36 5.12-7.168 9.216-12.288 11.264-15.36L419.84 240.64c-31.744 46.08-75.776 87.04-133.12 123.904 4.096 4.096 10.24 11.264 18.432 21.504l17.408 17.408c23.552-15.36 45.056-31.744 63.488-50.176 26.624 25.6 49.152 43.008 67.584 51.2-46.08 15.36-104.448 27.648-175.104 35.84 2.048 5.12 6.144 13.312 9.216 24.576 4.096 11.264 6.144 19.456 7.168 24.576l39.936-7.168v218.112H389.12V680.96h238.592v19.456h54.272V481.28H348.16c60.416-12.288 114.688-27.648 163.84-46.08 49.152 19.456 118.784 34.816 210.944 46.08 5.12-17.408 10.24-34.816 17.408-51.2-62.464-4.096-116.736-12.288-161.792-24.576 38.912-20.48 74.752-46.08 106.496-76.8z m-150.528 194.56h94.208v41.984h-94.208v-41.984z m0 78.848h94.208v41.984h-94.208v-41.984z m-144.384-78.848h94.208v41.984H390.144v-41.984z m0 78.848h94.208v41.984H390.144v-41.984zM424.96 326.656h182.272c-26.624 22.528-57.344 41.984-94.208 57.344-31.744-15.36-61.44-34.816-88.064-57.344z"></path></svg>
</span>
@@ -17,7 +17,7 @@
<a :href="'http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=' + theme.footerConfig.publicSecurityRecordCode.replace('号', '').substring(theme.footerConfig.publicSecurityRecordCode.indexOf('备') + 1)" target="_blank">{{ theme.footerConfig.publicSecurityRecordCode }}</a>
</span>
</p>
<p class="copyright" v-html="theme.footerConfig.copyright"></p>
<p v-if="theme.footerConfig.copyright" class="copyright" v-html="theme.footerConfig.copyright"></p>
</div>
</footer>
</template>

View File

@@ -3,9 +3,8 @@
</template>
<script lang="ts" setup>
import { reactive, toRefs, onBeforeUnmount, watch } from 'vue'
import { reactive, toRefs, onMounted, onBeforeUnmount } from 'vue'
import { WordCloud, G2 } from '@antv/g2plot'
import { debounce, useDark } from '@pureadmin/utils'
// 定义属性
const props = defineProps({
@@ -16,16 +15,9 @@ const props = defineProps({
})
// 渲染WordCloud
const theme = G2.getTheme('dark')
G2.registerTheme('customize-dark', {
...theme,
background: 'transparent',
})
const { isDark } = useDark()
let wordCloud
debounce(() => {
wordCloud = new WordCloud("wordcloud-container", {
onMounted(() => {
wordCloud = new WordCloud("wordcloud-container", {
data: props.dataList,
wordField: 'name',
weightField: 'value',
@@ -35,18 +27,11 @@ debounce(() => {
fontSize: [14, 35],
rotation: 0,
},
theme: isDark.value ? 'customize-dark' : 'light',
// 返回值设置成一个 [0, 1) 区间内的值,
// 可以让每次渲染的位置相同(前提是每次的宽高一致)。
random: () => 0.5,
random: () => 0.5
})
wordCloud.render()
}, 5)()
watch(isDark, (value) => {
value
? wordCloud?.update({ theme: 'customize-dark' })
: wordCloud?.update({ theme: 'light' })
})
onBeforeUnmount(() => {

View File

@@ -29,8 +29,8 @@ export function getQueryParam(paramName) {
*/
export function goToLink(url, paramName, paramValue) {
if (paramName) {
location.href = url + '?' + paramName + '=' + paramValue
window.location.href = url + '?' + paramName + '=' + paramValue
} else {
location.href = url
window.location.href = url
}
}

View File

@@ -6,4 +6,6 @@ lastUpdated: false
showComment: false
---
<Archive />
<ClientOnly>
<Archive />
</ClientOnly>

View File

@@ -6,4 +6,6 @@ lastUpdated: false
showComment: false
---
<Tag />
<ClientOnly>
<Tag />
</ClientOnly>

View File

@@ -5,7 +5,7 @@ export default {
plugins: [
Components({
dirs: ['.vitepress/theme/components'],
include: [/\.vue$/, /\.md$/],
include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
resolvers: [ArcoResolver({ sideEffect: true, resolveIcons: true })]
})
],