chore: change docs

This commit is contained in:
2023-04-17 21:02:44 +08:00
parent 07d0ff0785
commit fe029c5a0e
6 changed files with 42 additions and 25 deletions

View File

@ -0,0 +1,17 @@
<script lang="ts" setup>
import { onMounted, shallowRef } from 'vue'
const comp = shallowRef()
onMounted(async () => {
const { AntdTheme } = await import('vite-plugin-vitepress-demo/theme')
comp.value = AntdTheme
})
</script>
<template>
<ClientOnly>
<component v-bind="$attrs" :is="comp"></component>
</ClientOnly>
</template>
<style scoped></style>

View File

@ -10,20 +10,19 @@ const baseSrc = fileURLToPath(new URL('./', import.meta.url))
export default defineConfig({
rewrites: getRewrites(),
mpa: true,
lang: 'en-US',
ignoreDeadLinks: true,
locales: {
'zh-CN': {
lang: 'zh-CN',
title: 'vue3组件库站点',
title: 'Antd Tiny Vue',
label: '简体中文',
description: 'vue3组件库站点',
themeConfig: getZhCNConfig()
},
root: {
lang: 'en-US',
title: 'vue3 component library site',
title: 'Antd Tiny Vue',
label: 'English',
description: 'vue3 component library site',
themeConfig: getEnUSConfig()

View File

@ -1,15 +1,17 @@
import type { Theme } from 'vitepress'
// eslint-disable-next-line import/no-named-as-default
import DefaultTheme from 'vitepress/theme'
import { AntdTheme } from 'vite-plugin-vitepress-demo/theme'
// @ts-expect-error this is a local module
import Antd from 'antd-tiny-vue'
import AntdTheme from '../components/demo.vue'
export default {
...DefaultTheme,
enhanceApp(ctx) {
async enhanceApp(ctx) {
DefaultTheme.enhanceApp?.(ctx)
ctx.app.component('Demo', AntdTheme)
ctx.app.use(Antd)
// @ts-expect-error this is a local module
if (!import.meta.env.SSR) {
// @ts-expect-error this is a local module
const Antd = (await import('antd-tiny-vue')).default
ctx.app.use(Antd)
}
}
} as Theme