mirror of
https://gitee.com/newgateway/vtj.git
synced 2026-09-03 05:14:03 +08:00
fix(docs): 为预览组件添加 clientOnly 配置并提供 ElementPlus 注入键
- 在 Markdown 配置中为 containerPreview 和 componentPreview 添加 clientOnly 选项 - 在主题增强中通过 app.provide 提供 ElementPlus 的 ID_INJECTION_KEY 和 ZINDEX_INJECTION_KEY - 确保预览组件兼容客户端渲染环境
This commit is contained in:
@@ -62,8 +62,8 @@ export default defineConfig({
|
||||
},
|
||||
markdown: {
|
||||
config(md) {
|
||||
md.use(containerPreview);
|
||||
md.use(componentPreview);
|
||||
md.use(containerPreview, { clientOnly: true });
|
||||
md.use(componentPreview, { clientOnly: true });
|
||||
}
|
||||
},
|
||||
outDir,
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'regenerator-runtime/runtime';
|
||||
import { h, defineAsyncComponent } from 'vue';
|
||||
import { type Theme } from 'vitepress';
|
||||
import DefaultTheme from 'vitepress/theme';
|
||||
import { ID_INJECTION_KEY, ZINDEX_INJECTION_KEY } from 'element-plus';
|
||||
// @ts-ignore
|
||||
import { ElementPlusContainer } from '@vitepress-demo-preview/component';
|
||||
// import { ElMessageBox } from 'element-plus';
|
||||
@@ -20,6 +21,9 @@ export default {
|
||||
});
|
||||
},
|
||||
enhanceApp({ app, router, siteData }) {
|
||||
app.provide(ID_INJECTION_KEY, { prefix: 0, current: 0 });
|
||||
app.provide(ZINDEX_INJECTION_KEY, { current: 0 });
|
||||
|
||||
// app.component('demo-preview', ElementPlusContainer);
|
||||
app.component(
|
||||
'demo-preview',
|
||||
|
||||
Reference in New Issue
Block a user