1
0
mirror of synced 2026-04-05 07:48:35 +08:00

chore(docs): 升级vuepress

This commit is contained in:
roymondchen
2022-06-14 14:43:24 +08:00
committed by jia000
parent a72658d697
commit 470033487c
10 changed files with 660 additions and 2157 deletions

View File

@@ -0,0 +1,38 @@
import 'element-plus/dist/index.css';
import 'highlight.js/styles/github.css';
import { defineClientConfig } from '@vuepress/client';
import ElementPlus from 'element-plus';
import MagicForm from '@tmagic/form';
import DemoBlock from './demo-block.vue';
export default defineClientConfig({
enhance({ app, router, siteData }) {
app.use(ElementPlus);
app.use(MagicForm, {
request: (options: any) => new Promise((resolve) => {
if (options.url === 'select/remote') {
setTimeout(() => {
resolve({
data: [
{
name: 'select-1',
id: 1
},
{
name: 'select-2',
id: 2
},
],
});
}, 1000);
} else {
resolve({});
}
}),
});
app.component('demo-block', DemoBlock);
},
setup() {},
rootComponents: [],
})

View File

@@ -1,34 +0,0 @@
import 'element-plus/dist/index.css';
import 'highlight.js/styles/github.css';
import { defineClientAppEnhance } from '@vuepress/client';
import ElementPlus from 'element-plus';
import MagicForm from '@tmagic/form';
import DemoBlock from './demo-block.vue';
export default defineClientAppEnhance(({ app }) => {
app.use(ElementPlus);
app.use(MagicForm, {
request: (options: any) => new Promise((resolve) => {
if (options.url === 'select/remote') {
setTimeout(() => {
resolve({
data: [
{
name: 'select-1',
id: 1
},
{
name: 'select-2',
id: 2
},
],
});
}, 1000);
} else {
resolve({});
}
}),
});
app.component('demo-block', DemoBlock);
});

View File

@@ -1,5 +1,7 @@
import { viteBundler } from '@vuepress/bundler-vite'
import { defineUserConfig } from '@vuepress/cli'
import type { DefaultThemeOptions } from '@vuepress/theme-default'
import { defaultTheme } from '@vuepress/theme-default'
import path from 'path';
const sidebar = {
@@ -103,12 +105,13 @@ const sidebar = {
]
};
export default defineUserConfig<DefaultThemeOptions>({
export default defineUserConfig({
title: 'tmagic-editor',
description: 'magic',
clientAppEnhanceFiles: path.resolve(__dirname, './clientAppEnhance.ts'),
themeConfig: {
logo: 'https://vfiles.gtimg.cn/vupload/20210811/388ed01628667545737.png',
description: 'tmagic',
lang: 'zh-CN',
base: '/tmagic-editor/docs/',
theme: defaultTheme({
logo: './favicon.png',
navbar: [
{
text: '文档',
@@ -165,13 +168,11 @@ export default defineUserConfig<DefaultThemeOptions>({
'/api/form': sidebar.formApi,
'/api/form-config': sidebar.formConfig,
},
smoothScroll: false,
lastUpdated: false,
contributors: false,
},
base: '/tmagic-editor/docs/',
bundlerConfig: {
}),
bundler: viteBundler({
vuePluginOptions: {
template: {
ssr: true,
@@ -192,9 +193,13 @@ export default defineUserConfig<DefaultThemeOptions>({
alias:[
{ find: /^@tmagic\/form/, replacement: path.join(__dirname, '../../../packages/form/src/index.ts') },
{ find: /^@tmagic\/utils/, replacement: path.join(__dirname, '../../../packages/utils/src/index.ts') },
{ find: /^lodash-es$/, replacement: 'lodash' },
{ find: /^@tmagic\/schema/, replacement: path.join(__dirname, '../../../packages/schema/src/index.ts') },
]
},
// @ts-expect-error: vite 还没有给 ssr 配置项提供类型
ssr: {
noExternal: ['lodash-es'],
}
},
},
}),
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

@@ -1,6 +1,6 @@
---
home: true
heroImage: https://vfiles.gtimg.cn/vupload/20210811/388ed01628667545737.png
heroImage: ./favicon.png
heroText: tmagic-editor页面可视化平台
tagline: null