chore(docs): 升级vuepress
This commit is contained in:
38
docs/src/.vuepress/client.ts
Normal file
38
docs/src/.vuepress/client.ts
Normal 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: [],
|
||||
})
|
||||
@@ -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);
|
||||
});
|
||||
@@ -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'],
|
||||
}
|
||||
},
|
||||
},
|
||||
}),
|
||||
});
|
||||
|
||||
BIN
docs/src/.vuepress/public/favicon.png
Normal file
BIN
docs/src/.vuepress/public/favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.6 KiB |
@@ -1,6 +1,6 @@
|
||||
---
|
||||
home: true
|
||||
heroImage: https://vfiles.gtimg.cn/vupload/20210811/388ed01628667545737.png
|
||||
heroImage: ./favicon.png
|
||||
heroText: tmagic-editor页面可视化平台
|
||||
tagline: null
|
||||
|
||||
|
||||
Reference in New Issue
Block a user