antd-tiny-vue/.vitepress/theme/index.ts

19 lines
618 B
TypeScript
Raw Normal View History

2023-02-26 08:20:18 +08:00
import type { Theme } from 'vitepress'
// eslint-disable-next-line import/no-named-as-default
import DefaultTheme from 'vitepress/theme'
2023-04-17 21:02:44 +08:00
import AntdTheme from '../components/demo.vue'
2023-04-20 07:15:36 +08:00
// import { AntdTheme } from 'vite-plugin-vitepress-demo/theme'
2023-02-26 08:20:18 +08:00
export default {
...DefaultTheme,
2023-04-17 21:02:44 +08:00
async enhanceApp(ctx) {
2023-02-26 08:20:18 +08:00
DefaultTheme.enhanceApp?.(ctx)
ctx.app.component('Demo', AntdTheme)
2023-04-17 21:02:44 +08:00
// @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)
}
2023-02-26 08:20:18 +08:00
}
} as Theme