doc: update

pull/4606/head
tangjinzhou 2021-09-01 22:57:51 +08:00
parent c4ea14358e
commit ed9bdd8923
21 changed files with 483 additions and 83 deletions

View File

@ -11,7 +11,13 @@ module.exports = {
parserOptions: { parserOptions: {
parser: 'babel-eslint', parser: 'babel-eslint',
}, },
extends: ['plugin:vue/vue3-recommended', 'prettier'], extends: [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/typescript/recommended',
'@vue/prettier',
'@vue/prettier/@typescript-eslint',
],
plugins: ['markdown', 'jest', '@typescript-eslint'], plugins: ['markdown', 'jest', '@typescript-eslint'],
overrides: [ overrides: [
{ {
@ -52,24 +58,24 @@ module.exports = {
camelcase: 'off', camelcase: 'off',
'no-extra-boolean-cast': 'off', 'no-extra-boolean-cast': 'off',
semi: ['error', 'always'], semi: ['error', 'always'],
'vue/require-explicit-emits': 'off', // 'vue/require-explicit-emits': 'off',
'vue/require-prop-types': 'off', // 'vue/require-prop-types': 'off',
'vue/require-default-prop': 'off', // 'vue/require-default-prop': 'off',
'vue/no-reserved-keys': 'off', // 'vue/no-reserved-keys': 'off',
'vue/comment-directive': 'off', // 'vue/comment-directive': 'off',
'vue/prop-name-casing': 'off', // 'vue/prop-name-casing': 'off',
'vue/one-component-per-file': 'off', // 'vue/one-component-per-file': 'off',
'vue/custom-event-name-casing': 'off', // 'vue/custom-event-name-casing': 'off',
'vue/max-attributes-per-line': [ // 'vue/max-attributes-per-line': [
2, // 2,
{ // {
singleline: 20, // singleline: 20,
multiline: { // multiline: {
max: 1, // max: 1,
allowFirstLine: false, // allowFirstLine: false,
}, // },
}, // },
], // ],
}, },
globals: { globals: {
h: true, h: true,

View File

@ -5,7 +5,7 @@
</template> </template>
<script> <script>
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
import demo from '../v2-doc/src/docs/popover/demo/index.vue'; import demo from '../components/popover/demo/index.vue';
// import Affix from '../components/affix'; // import Affix from '../components/affix';
export default defineComponent({ export default defineComponent({
components: { components: {

View File

@ -22,6 +22,7 @@
display: none; display: none;
} }
</style> </style>
<script type="module" src="/index.ts"></script>
</head> </head>
<body> <body>

View File

@ -1,7 +1,7 @@
import path from 'path'; import path from 'path';
import vue from '@vitejs/plugin-vue'; import vue from '@vitejs/plugin-vue';
import md from './plugin/md'; import md from '../plugin/md';
import docs from './plugin/docs'; import docs from '../plugin/docs';
import vueJsx from '@vitejs/plugin-vue-jsx'; import vueJsx from '@vitejs/plugin-vue-jsx';
/** /**
@ -11,7 +11,7 @@ export default {
resolve: { resolve: {
alias: { alias: {
vue: 'vue/dist/vue.esm-bundler.js', vue: 'vue/dist/vue.esm-bundler.js',
'ant-design-vue': path.resolve(__dirname, './components'), 'ant-design-vue': path.resolve(__dirname, '../components'),
}, },
}, },
plugins: [ plugins: [

View File

@ -1,31 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<meta
name="description"
content="An enterprise-class UI components based on Ant Design and Vue"
/>
<title>Ant Design Vue</title>
<meta
name="keywords"
content="ant design vue,ant-design-vue,ant-design-vue admin,ant design pro,vue ant design,vue ant design pro,vue ant design admin,ant design vue官网,ant design vue中文文档,ant design vue文档"
/>
<link rel="shortcut icon" type="image/x-icon" href="https://qn.antdv.com/favicon.ico" />
<style id="nprogress-style">
#nprogress {
display: none;
}
</style>
<script type="module" src="/examples/index.ts"></script>
</head>
<body>
<div id="app" style="padding: 50px"></div>
</body>
</html>

View File

@ -28,8 +28,8 @@
"vetur" "vetur"
], ],
"scripts": { "scripts": {
"debugger": "vite", "debugger": "vite serve examples",
"dev": "vite serve site", "dev": "yarn routes && vite serve site",
"test": "cross-env NODE_ENV=test WORKFLOW=true jest --config .jest.js", "test": "cross-env NODE_ENV=test WORKFLOW=true jest --config .jest.js",
"test:dev": "cross-env NODE_ENV=test jest --config .jest.js", "test:dev": "cross-env NODE_ENV=test jest --config .jest.js",
"compile": "node antd-tools/cli/run.js compile", "compile": "node antd-tools/cli/run.js compile",
@ -43,7 +43,8 @@
"dist": "node --max_old_space_size=8192 antd-tools/cli/run.js dist", "dist": "node --max_old_space_size=8192 antd-tools/cli/run.js dist",
"lint": "eslint -c ./.eslintrc.js --fix --ext .jsx,.js,.ts,.tsx ./components", "lint": "eslint -c ./.eslintrc.js --fix --ext .jsx,.js,.ts,.tsx ./components",
"lint:style": "stylelint \"{site,components}/**/*.less\" --syntax less", "lint:style": "stylelint \"{site,components}/**/*.less\" --syntax less",
"codecov": "codecov" "codecov": "codecov",
"routes": "node site/scripts/genrateRoutes.js"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

13
scripts/compact-vars.js Normal file
View File

@ -0,0 +1,13 @@
const fs = require('fs');
const path = require('path');
const lessToJs = require('less-vars-to-js');
const stylePath = path.join(__dirname, '..', 'components', 'style');
const compactLess = fs.readFileSync(path.join(stylePath, 'themes', 'compact.less'), 'utf8');
const compactPaletteLess = lessToJs(compactLess, {
stripPrefix: true,
resolveVariables: false,
});
module.exports = compactPaletteLess;

View File

@ -6,12 +6,12 @@ const matter = require('gray-matter');
const { CLIEngine } = require('eslint'); const { CLIEngine } = require('eslint');
(async () => { (async () => {
const paths = await globby('src/docs/*/index.*.md'); const paths = await globby('components/*/index.*.md');
const components = {}; const components = {};
paths.forEach(path => { paths.forEach(path => {
const content = fs.readFileSync(path).toString(); const content = fs.readFileSync(path).toString();
const componentName = path.split('/')[2]; const componentName = path.split('/')[1];
if (componentName !== 'color-picker') { if (componentName !== 'color-picker') {
const { data } = matter(content); const { data } = matter(content);
@ -25,7 +25,7 @@ export default [
{ {
path: '${component}:lang(-cn)?', path: '${component}:lang(-cn)?',
meta: ${JSON.stringify(components[component])}, meta: ${JSON.stringify(components[component])},
component: () => import('../docs/${component}/demo/index.vue'), component: () => import('../../../components/${component}/demo/index.vue'),
}`, }`,
)} )}
];`; ];`;
@ -38,5 +38,5 @@ export default [
const report = engine.executeOnText(TEMPLATE); const report = engine.executeOnText(TEMPLATE);
fs.writeFileSync('src/router/demoRoutes.js', report.results[0].output); fs.writeFileSync('site/src/router/demoRoutes.js', report.results[0].output);
})(); })();

View File

@ -10,8 +10,8 @@ import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import useMediaQuery from './hooks/useMediaQuery'; import useMediaQuery from './hooks/useMediaQuery';
import { GLOBAL_CONFIG } from './SymbolKey'; import { GLOBAL_CONFIG } from './SymbolKey';
import enUS from 'ant-design-vue/es/locale/en_US'; import enUS from '../../components/locale/en_US';
import zhCN from 'ant-design-vue/es/locale/zh_CN'; import zhCN from '../../components/locale/zh_CN';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import 'dayjs/locale/zh-cn'; import 'dayjs/locale/zh-cn';
function isZhCN(name: string) { function isZhCN(name: string) {

View File

@ -98,11 +98,7 @@ export default defineComponent({
const copied = ref(false); const copied = ref(false);
const sectionId = computed(() => { const sectionId = computed(() => {
const relativePath = props.jsfiddle?.relativePath || ''; const relativePath = props.jsfiddle?.relativePath || '';
return `components-${relativePath return `${relativePath.split('/').join('-').replace('.vue', '')}`;
.split('/docs/')[1]
.split('/')
.join('-')
.replace('.vue', '')}`;
}); });
const inIframe = inject('inIframe', false); const inIframe = inject('inIframe', false);
const iframeHeight = computed(() => props.jsfiddle?.iframe); const iframeHeight = computed(() => props.jsfiddle?.iframe);

View File

@ -1,5 +1,6 @@
<template> <template>
<article> <article>
hello
<section class="markdown"> <section class="markdown">
<h1> <h1>
{{ frontmatter.title }} {{ frontmatter.title }}
@ -11,7 +12,7 @@
<h2>{{ $t('app.component.examples') }}</h2> <h2>{{ $t('app.component.examples') }}</h2>
</section> </section>
<slot /> <slot />
<GoogleAds v-if="showAd" :key="`goo-${route.path}`" /> <!-- <GoogleAds v-if="showAd" :key="`goo-${route.path}`" /> -->
<section class="markdown api-container" v-html="api"></section> <section class="markdown api-container" v-html="api"></section>
</article> </article>
</template> </template>

View File

@ -1,4 +1,4 @@
import 'ant-design-vue/dist/antd.less'; import '../../components/style';
import 'docsearch.js/dist/cdn/docsearch.css'; import 'docsearch.js/dist/cdn/docsearch.css';
import './index.less'; import './index.less';
import 'nprogress/nprogress.css'; import 'nprogress/nprogress.css';
@ -18,11 +18,11 @@ const app = createApp(App);
app.use(Antd); app.use(Antd);
app.use(clipboard); app.use(clipboard);
app.component('transition', Transition); app.component('Transition', Transition);
app.component('transition-group', TransitionGroup); app.component('TransitionGroup', TransitionGroup);
app.component('demo-box', demoBox); app.component('DemoBox', demoBox);
app.component('demo-container', demoContainer); app.component('DemoContainer', demoContainer);
app.component('demo-sort', demoSort); app.component('DemoSort', demoSort);
app.component('VNodes', function (_, { attrs: { value } }) { app.component('VNodes', function (_, { attrs: { value } }) {
return value; return value;
}); });

View File

@ -0,0 +1,319 @@
export default [
{
path: 'affix:lang(-cn)?',
meta: {"category":"Components","type":"导航","title":"Affix","cover":"https://gw.alipayobjects.com/zos/alicdn/tX6-md4H6/Affix.svg","subtitle":"固钉"},
component: () => import('../../../components/affix/demo/index.vue'),
},
{
path: 'alert:lang(-cn)?',
meta: {"category":"Components","type":"反馈","title":"Alert","cover":"https://gw.alipayobjects.com/zos/alicdn/8emPa3fjl/Alert.svg","subtitle":"警告提示"},
component: () => import('../../../components/alert/demo/index.vue'),
},
{
path: 'anchor:lang(-cn)?',
meta: {"category":"Components","type":"其他","cols":2,"title":"Anchor","cover":"https://gw.alipayobjects.com/zos/alicdn/_1-C1JwsC/Anchor.svg","subtitle":"锚点"},
component: () => import('../../../components/anchor/demo/index.vue'),
},
{
path: 'avatar:lang(-cn)?',
meta: {"category":"Components","type":"数据展示","title":"Avatar","cover":"https://gw.alipayobjects.com/zos/antfincdn/aBcnbw68hP/Avatar.svg","subtitle":"头像"},
component: () => import('../../../components/avatar/demo/index.vue'),
},
{
path: 'auto-complete:lang(-cn)?',
meta: {"category":"Components","type":"数据录入","cols":2,"title":"AutoComplete","cover":"https://gw.alipayobjects.com/zos/alicdn/qtJm4yt45/AutoComplete.svg","subtitle":"自动完成"},
component: () => import('../../../components/auto-complete/demo/index.vue'),
},
{
path: 'badge:lang(-cn)?',
meta: {"category":"Components","type":"数据展示","title":"Badge","cover":"https://gw.alipayobjects.com/zos/antfincdn/6%26GF9WHwvY/Badge.svg","subtitle":"徽标数"},
component: () => import('../../../components/badge/demo/index.vue'),
},
{
path: 'back-top:lang(-cn)?',
meta: {"category":"Components","type":"其他","title":"BackTop","cover":"https://gw.alipayobjects.com/zos/alicdn/tJZ5jbTwX/BackTop.svg","subtitle":"回到顶部"},
component: () => import('../../../components/back-top/demo/index.vue'),
},
{
path: 'button:lang(-cn)?',
meta: {"category":"Components","type":"通用","title":"Button","cover":"https://gw.alipayobjects.com/zos/alicdn/fNUKzY1sk/Button.svg","subtitle":"按钮"},
component: () => import('../../../components/button/demo/index.vue'),
},
{
path: 'breadcrumb:lang(-cn)?',
meta: {"category":"Components","type":"导航","title":"Breadcrumb","cover":"https://gw.alipayobjects.com/zos/alicdn/9Ltop8JwH/Breadcrumb.svg","subtitle":"面包屑"},
component: () => import('../../../components/breadcrumb/demo/index.vue'),
},
{
path: 'calendar:lang(-cn)?',
meta: {"category":"Components","type":"数据展示","title":"Calendar","cover":"https://gw.alipayobjects.com/zos/antfincdn/dPQmLq08DI/Calendar.svg","subtitle":"日历"},
component: () => import('../../../components/calendar/demo/index.vue'),
},
{
path: 'card:lang(-cn)?',
meta: {"category":"Components","type":"数据展示","title":"Card","cover":"https://gw.alipayobjects.com/zos/antfincdn/NqXt8DJhky/Card.svg","subtitle":"卡片"},
component: () => import('../../../components/card/demo/index.vue'),
},
{
path: 'carousel:lang(-cn)?',
meta: {"category":"Components","type":"数据展示","title":"Carousel","cover":"https://gw.alipayobjects.com/zos/antfincdn/%24C9tmj978R/Carousel.svg","subtitle":"走马灯"},
component: () => import('../../../components/carousel/demo/index.vue'),
},
{
path: 'cascader:lang(-cn)?',
meta: {"category":"Components","type":"数据录入","title":"Cascader","cover":"https://gw.alipayobjects.com/zos/alicdn/UdS8y8xyZ/Cascader.svg","subtitle":"级联选择"},
component: () => import('../../../components/cascader/demo/index.vue'),
},
{
path: 'checkbox:lang(-cn)?',
meta: {"category":"Components","type":"数据录入","title":"Checkbox","cover":"https://gw.alipayobjects.com/zos/alicdn/8nbVbHEm_/CheckBox.svg","subtitle":"多选框"},
component: () => import('../../../components/checkbox/demo/index.vue'),
},
{
path: 'collapse:lang(-cn)?',
meta: {"category":"Components","type":"数据展示","title":"Collapse","cover":"https://gw.alipayobjects.com/zos/alicdn/IxH16B9RD/Collapse.svg","subtitle":"折叠面板"},
component: () => import('../../../components/collapse/demo/index.vue'),
},
{
path: 'comment:lang(-cn)?',
meta: {"category":"Components","type":"数据展示","title":"Comment","cover":"https://gw.alipayobjects.com/zos/alicdn/ILhxpGzBO/Comment.svg","subtitle":"评论"},
component: () => import('../../../components/comment/demo/index.vue'),
},
{
path: 'config-provider:lang(-cn)?',
meta: {"category":"Components","type":"其他","cols":1,"title":"ConfigProvider","cover":"https://gw.alipayobjects.com/zos/alicdn/kegYxl1wj/ConfigProvider.svg","subtitle":"全局化配置"},
component: () => import('../../../components/config-provider/demo/index.vue'),
},
{
path: 'date-picker:lang(-cn)?',
meta: {"category":"Components","type":"数据录入","title":"DatePicker","cover":"https://gw.alipayobjects.com/zos/alicdn/RT_USzA48/DatePicker.svg","subtitle":"日期选择框"},
component: () => import('../../../components/date-picker/demo/index.vue'),
},
{
path: 'descriptions:lang(-cn)?',
meta: {"category":"Components","type":"数据展示","title":"Descriptions","cover":"https://gw.alipayobjects.com/zos/alicdn/MjtG9_FOI/Descriptions.svg","subtitle":"描述列表"},
component: () => import('../../../components/descriptions/demo/index.vue'),
},
{
path: 'divider:lang(-cn)?',
meta: {"category":"Components","type":"布局","title":"Divider","cover":"https://gw.alipayobjects.com/zos/alicdn/5swjECahe/Divider.svg","subtitle":"分割线"},
component: () => import('../../../components/divider/demo/index.vue'),
},
{
path: 'drawer:lang(-cn)?',
meta: {"category":"Components","type":"反馈","title":"Drawer","cover":"https://gw.alipayobjects.com/zos/alicdn/7z8NJQhFb/Drawer.svg","subtitle":"抽屉"},
component: () => import('../../../components/drawer/demo/index.vue'),
},
{
path: 'dropdown:lang(-cn)?',
meta: {"category":"Components","type":"导航","title":"Dropdown","cover":"https://gw.alipayobjects.com/zos/alicdn/eedWN59yJ/Dropdown.svg","subtitle":"下拉菜单"},
component: () => import('../../../components/dropdown/demo/index.vue'),
},
{
path: 'empty:lang(-cn)?',
meta: {"category":"Components","type":"数据展示","title":"Empty","cover":"https://gw.alipayobjects.com/zos/alicdn/MNbKfLBVb/Empty.svg","subtitle":"空状态"},
component: () => import('../../../components/empty/demo/index.vue'),
},
{
path: 'form:lang(-cn)?',
meta: {"category":"Components","type":"数据录入","cols":1,"title":"Form","cover":"https://gw.alipayobjects.com/zos/alicdn/ORmcdeaoO/Form.svg","subtitle":"表单"},
component: () => import('../../../components/form/demo/index.vue'),
},
{
path: 'grid:lang(-cn)?',
meta: {"category":"Components","type":"布局","cols":1,"title":"Grid","cover":"https://gw.alipayobjects.com/zos/alicdn/5rWLU27so/Grid.svg","subtitle":"栅格"},
component: () => import('../../../components/grid/demo/index.vue'),
},
{
path: 'icon:lang(-cn)?',
meta: {"category":"Components","type":"通用","title":"Icon","cover":"https://gw.alipayobjects.com/zos/alicdn/rrwbSt3FQ/Icon.svg","subtitle":"图标"},
component: () => import('../../../components/icon/demo/index.vue'),
},
{
path: 'image:lang(-cn)?',
meta: {"category":"Components","type":"数据展示","title":"Image","cover":"https://gw.alipayobjects.com/zos/antfincdn/D1dXz9PZqa/image.svg","subtitle":"图片"},
component: () => import('../../../components/image/demo/index.vue'),
},
{
path: 'input:lang(-cn)?',
meta: {"category":"Components","type":"数据录入","title":"Input","cover":"https://gw.alipayobjects.com/zos/alicdn/xS9YEJhfe/Input.svg","subtitle":"输入框"},
component: () => import('../../../components/input/demo/index.vue'),
},
{
path: 'input-number:lang(-cn)?',
meta: {"category":"Components","type":"数据录入","title":"InputNumber","cover":"https://gw.alipayobjects.com/zos/alicdn/XOS8qZ0kU/InputNumber.svg","subtitle":"数字输入框"},
component: () => import('../../../components/input-number/demo/index.vue'),
},
{
path: 'layout:lang(-cn)?',
meta: {"category":"Components","type":"布局","cols":1,"title":"Layout","cover":"https://gw.alipayobjects.com/zos/alicdn/hzEndUVEx/Layout.svg","subtitle":"布局"},
component: () => import('../../../components/layout/demo/index.vue'),
},
{
path: 'list:lang(-cn)?',
meta: {"category":"Components","type":"数据展示","title":"List","cover":"https://gw.alipayobjects.com/zos/alicdn/5FrZKStG_/List.svg","subtitle":"列表"},
component: () => import('../../../components/list/demo/index.vue'),
},
{
path: 'mentions:lang(-cn)?',
meta: {"category":"Components","type":"数据录入","title":"Mentions","cover":"https://gw.alipayobjects.com/zos/alicdn/jPE-itMFM/Mentions.svg","subtitle":"提及"},
component: () => import('../../../components/mentions/demo/index.vue'),
},
{
path: 'menu:lang(-cn)?',
meta: {"category":"Components","cols":1,"type":"导航","title":"Menu","cover":"https://gw.alipayobjects.com/zos/alicdn/3XZcjGpvK/Menu.svg","subtitle":"导航菜单"},
component: () => import('../../../components/menu/demo/index.vue'),
},
{
path: 'message:lang(-cn)?',
meta: {"category":"Components","type":"反馈","title":"Message","cover":"https://gw.alipayobjects.com/zos/alicdn/hAkKTIW0K/Message.svg","subtitle":"全局提示"},
component: () => import('../../../components/message/demo/index.vue'),
},
{
path: 'modal:lang(-cn)?',
meta: {"category":"Components","type":"反馈","title":"Modal","cover":"https://gw.alipayobjects.com/zos/alicdn/3StSdUlSH/Modal.svg","subtitle":"对话框"},
component: () => import('../../../components/modal/demo/index.vue'),
},
{
path: 'notification:lang(-cn)?',
meta: {"category":"Components","type":"反馈","title":"Notification","cover":"https://gw.alipayobjects.com/zos/alicdn/Jxm5nw61w/Notification.svg","subtitle":"通知提醒框"},
component: () => import('../../../components/notification/demo/index.vue'),
},
{
path: 'page-header:lang(-cn)?',
meta: {"category":"Components","type":"导航","title":"PageHeader","cols":1,"subtitle":"页头","cover":"https://gw.alipayobjects.com/zos/alicdn/6bKE0Cq0R/PageHeader.svg"},
component: () => import('../../../components/page-header/demo/index.vue'),
},
{
path: 'pagination:lang(-cn)?',
meta: {"category":"Components","type":"导航","title":"Pagination","cols":1,"cover":"https://gw.alipayobjects.com/zos/alicdn/1vqv2bj68/Pagination.svg","subtitle":"分页"},
component: () => import('../../../components/pagination/demo/index.vue'),
},
{
path: 'popconfirm:lang(-cn)?',
meta: {"category":"Components","type":"反馈","title":"Popconfirm","cover":"https://gw.alipayobjects.com/zos/alicdn/fjMCD9xRq/Popconfirm.svg","subtitle":"气泡确认框"},
component: () => import('../../../components/popconfirm/demo/index.vue'),
},
{
path: 'popover:lang(-cn)?',
meta: {"category":"Components","type":"数据展示","title":"Popover","cover":"https://gw.alipayobjects.com/zos/alicdn/1PNL1p_cO/Popover.svg","subtitle":"气泡卡片"},
component: () => import('../../../components/popover/demo/index.vue'),
},
{
path: 'progress:lang(-cn)?',
meta: {"category":"Components","type":"反馈","title":"Progress","cover":"https://gw.alipayobjects.com/zos/alicdn/xqsDu4ZyR/Progress.svg","subtitle":"进度条"},
component: () => import('../../../components/progress/demo/index.vue'),
},
{
path: 'radio:lang(-cn)?',
meta: {"category":"Components","type":"数据录入","title":"Radio","cover":"https://gw.alipayobjects.com/zos/alicdn/8cYb5seNB/Radio.svg","subtitle":"单选框"},
component: () => import('../../../components/radio/demo/index.vue'),
},
{
path: 'rate:lang(-cn)?',
meta: {"category":"Components","type":"数据录入","title":"Rate","cover":"https://gw.alipayobjects.com/zos/alicdn/R5uiIWmxe/Rate.svg","subtitle":"评分"},
component: () => import('../../../components/rate/demo/index.vue'),
},
{
path: 'result:lang(-cn)?',
meta: {"category":"Components","type":"反馈","title":"Result","cover":"https://gw.alipayobjects.com/zos/alicdn/9nepwjaLa/Result.svg","subtitle":"结果"},
component: () => import('../../../components/result/demo/index.vue'),
},
{
path: 'select:lang(-cn)?',
meta: {"category":"Components","type":"数据录入","title":"Select","cover":"https://gw.alipayobjects.com/zos/alicdn/_0XzgOis7/Select.svg","subtitle":"选择器"},
component: () => import('../../../components/select/demo/index.vue'),
},
{
path: 'skeleton:lang(-cn)?',
meta: {"category":"Components","type":"反馈","title":"Skeleton","cover":"https://gw.alipayobjects.com/zos/alicdn/KpcciCJgv/Skeleton.svg","subtitle":"骨架屏"},
component: () => import('../../../components/skeleton/demo/index.vue'),
},
{
path: 'slider:lang(-cn)?',
meta: {"category":"Components","type":"数据录入","title":"Slider","cover":"https://gw.alipayobjects.com/zos/alicdn/HZ3meFc6W/Silder.svg","subtitle":"滑动输入条"},
component: () => import('../../../components/slider/demo/index.vue'),
},
{
path: 'space:lang(-cn)?',
meta: {"category":"Components","type":"布局","title":"Space","cols":1,"cover":"https://gw.alipayobjects.com/zos/antfincdn/wc6%263gJ0Y8/Space.svg","subtitle":"间距"},
component: () => import('../../../components/space/demo/index.vue'),
},
{
path: 'spin:lang(-cn)?',
meta: {"category":"Components","type":"反馈","title":"Spin","cover":"https://gw.alipayobjects.com/zos/alicdn/8emPa3fjl/Alert.svg","subtitle":"加载中"},
component: () => import('../../../components/spin/demo/index.vue'),
},
{
path: 'statistic:lang(-cn)?',
meta: {"category":"Components","type":"数据展示","title":"Statistic","cover":"https://gw.alipayobjects.com/zos/antfincdn/rcBNhLBrKbE/Statistic.svg","subtitle":"统计数值"},
component: () => import('../../../components/statistic/demo/index.vue'),
},
{
path: 'steps:lang(-cn)?',
meta: {"category":"Components","type":"导航","cols":1,"title":"Steps","cover":"https://gw.alipayobjects.com/zos/antfincdn/UZYqMizXHaj/Steps.svg","subtitle":"步骤条"},
component: () => import('../../../components/steps/demo/index.vue'),
},
{
path: 'switch:lang(-cn)?',
meta: {"category":"Components","type":"数据录入","title":"Switch","cover":"https://gw.alipayobjects.com/zos/alicdn/zNdJQMhfm/Switch.svg","subtitle":"开关"},
component: () => import('../../../components/switch/demo/index.vue'),
},
{
path: 'table:lang(-cn)?',
meta: {"category":"Components","cols":1,"type":"数据展示","title":"Table","cover":"https://gw.alipayobjects.com/zos/alicdn/f-SbcX2Lx/Table.svg","subtitle":"表格"},
component: () => import('../../../components/table/demo/index.vue'),
},
{
path: 'tabs:lang(-cn)?',
meta: {"category":"Components","type":"数据展示","title":"Tabs","cover":"https://gw.alipayobjects.com/zos/antfincdn/lkI2hNEDr2V/Tabs.svg","subtitle":"标签页"},
component: () => import('../../../components/tabs/demo/index.vue'),
},
{
path: 'tag:lang(-cn)?',
meta: {"category":"Components","type":"数据展示","title":"Tag","cover":"https://gw.alipayobjects.com/zos/alicdn/cH1BOLfxC/Tag.svg","subtitle":"标签"},
component: () => import('../../../components/tag/demo/index.vue'),
},
{
path: 'time-picker:lang(-cn)?',
meta: {"category":"Components","type":"数据录入","title":"TimePicker","cover":"https://gw.alipayobjects.com/zos/alicdn/h04Zsl98I/TimePicker.svg","subtitle":"时间选择框"},
component: () => import('../../../components/time-picker/demo/index.vue'),
},
{
path: 'timeline:lang(-cn)?',
meta: {"category":"Components","type":"数据展示","title":"Timeline","cover":"https://gw.alipayobjects.com/zos/antfincdn/vJmo00mmgR/Timeline.svg","subtitle":"时间轴"},
component: () => import('../../../components/timeline/demo/index.vue'),
},
{
path: 'tooltip:lang(-cn)?',
meta: {"category":"Components","type":"数据展示","title":"Tooltip","cover":"https://gw.alipayobjects.com/zos/alicdn/Vyyeu8jq2/Tooltp.svg","subtitle":"文字提示"},
component: () => import('../../../components/tooltip/demo/index.vue'),
},
{
path: 'transfer:lang(-cn)?',
meta: {"category":"Components","type":"数据录入","title":"Transfer","cover":"https://gw.alipayobjects.com/zos/alicdn/QAXskNI4G/Transfer.svg","subtitle":"穿梭框"},
component: () => import('../../../components/transfer/demo/index.vue'),
},
{
path: 'tree:lang(-cn)?',
meta: {"category":"Components","type":"数据展示","title":"Tree","cover":"https://gw.alipayobjects.com/zos/alicdn/Xh-oWqg9k/Tree.svg","subtitle":"树形控件"},
component: () => import('../../../components/tree/demo/index.vue'),
},
{
path: 'tree-select:lang(-cn)?',
meta: {"category":"Components","type":"数据录入","title":"TreeSelect","cover":"https://gw.alipayobjects.com/zos/alicdn/Ax4DA0njr/TreeSelect.svg","subtitle":"树选择"},
component: () => import('../../../components/tree-select/demo/index.vue'),
},
{
path: 'typography:lang(-cn)?',
meta: {"category":"Components","type":"通用","title":"Typography","cols":1,"cover":"https://gw.alipayobjects.com/zos/alicdn/GOM1KQ24O/Typography.svg","subtitle":"排版"},
component: () => import('../../../components/typography/demo/index.vue'),
},
{
path: 'upload:lang(-cn)?',
meta: {"category":"Components","type":"数据录入","title":"Upload","cover":"https://gw.alipayobjects.com/zos/alicdn/QaeBt_ZMg/Upload.svg","subtitle":"上传"},
component: () => import('../../../components/upload/demo/index.vue'),
},
];

View File

@ -35,7 +35,7 @@ const routes = [
const hash = route.hash.replace('#', ''); const hash = route.hash.replace('#', '');
return { iframeName: hash }; return { iframeName: hash };
}, },
component: () => import('../docs/layout/demo/index.vue'), component: () => import('../../../components/layout/demo/index.vue'),
}, },
], ],
}, },

View File

@ -1,4 +1,4 @@
@import '../../../node_modules/ant-design-vue/es/style/themes/default.less'; @import '../../../../components/style/themes/default.less';
#header { #header {
// ===================== Home Page ===================== // ===================== Home Page =====================

View File

@ -1,5 +1,5 @@
@import './reset.less'; @import './reset.less';
@import '../../../node_modules/ant-design-vue/es/style/themes/default.less'; @import '../../../../components/style/themes/default.less';
@import './theme'; @import './theme';
@import './common'; @import './common';
@import './header'; @import './header';

View File

@ -1,4 +1,4 @@
@import "../../../node_modules/ant-design-vue/es/style/themes/default.less"; @import '../../../../components/style/themes/default.less';
.nav-phone-icon { .nav-phone-icon {
position: absolute; position: absolute;

View File

@ -1,9 +1,8 @@
@import '../../../node_modules/ant-design-vue/es/style/themes/default.less'; @import '../../../../components/style/themes/default.less';
@import './colors.less'; @import './colors.less';
@import './home.less'; @import './home.less';
@input-icon-hover-color: rgba(0, 0, 0, 0.85);
@input-icon-hover-color: rgba(0,0,0,.85);
@site-heading-color: @heading-color; @site-heading-color: @heading-color;
@site-text-color: @heading-color; @site-text-color: @heading-color;

49
site/themeConfig.ts Normal file
View File

@ -0,0 +1,49 @@
import less from 'less';
// import { getThemeVariables } from 'ant-design-vue/dist/theme';
const themeConfig = [
{
theme: 'dark',
htmlThemeAttr: 'dark',
modifyVars: {
// ...getThemeVariables({ dark: true }),
'text-color': 'fade(@white, 65%)',
'gray-8': '@text-color',
'background-color-base': '#555',
'skeleton-color': 'rgba(0,0,0,0.8)',
},
},
];
const additionalData = async (content: string, filename: string): Promise<string> => {
const themePromises = themeConfig.map(async t => {
const { htmlThemeAttr, modifyVars = {} } = t;
const options = {
javascriptEnabled: true,
modifyVars,
relativeUrls: true,
filename,
};
try {
const { css } = await less.render(content, options);
let res = '';
if (htmlThemeAttr && css) {
res = `
[data-doc-theme=${htmlThemeAttr}] {
${css}
}
`;
}
return Promise.resolve(res);
} catch (error) {
return Promise.reject(content);
}
});
let res = content;
for (const themePromise of themePromises) {
const theme = await themePromise;
res += theme;
}
return res;
};
export default themeConfig;
export { themeConfig, additionalData };

46
site/vite.config.ts Normal file
View File

@ -0,0 +1,46 @@
import path from 'path';
import vue from '@vitejs/plugin-vue';
import md from '../plugin/md';
import docs from '../plugin/docs';
import vueJsx from '@vitejs/plugin-vue-jsx';
// import { getThemeVariables } from 'ant-design-vue/dist/theme';
import { additionalData } from './themeConfig';
import defaultVar from '../scripts/default-vars';
import compact from '../scripts/compact-vars';
// import dark from '../scripts/dark-vars';
/**
* @type {import('vite').UserConfig}
*/
export default {
resolve: {
alias: {
// moment: 'moment/dist/moment.js',
'@': path.join(__dirname, './src'),
vue: 'vue/dist/vue.esm-bundler.js',
'ant-design-vue': path.resolve(__dirname, '../components'),
},
},
plugins: [
vueJsx({
// options are passed on to @vue/babel-plugin-jsx
}),
docs(),
md(),
vue({
include: [/\.vue$/, /\.md$/],
}),
],
optimizeDeps: {
include: ['fetch-jsonp', '@ant-design/icons-vue', 'lodash-es'],
},
css: {
preprocessorOptions: {
less: {
modifyVars: { ...defaultVar },
javascriptEnabled: true,
// includePaths: ["node_modules/"],
// additionalData,
},
},
},
};

View File

@ -12,7 +12,7 @@
"lib": ["dom", "es2017"], "lib": ["dom", "es2017"],
"skipLibCheck": true, "skipLibCheck": true,
"allowJs": true, "allowJs": true,
"importsNotUsedAsValues": "error" "importsNotUsedAsValues": "preserve"
}, },
"exclude": [ "exclude": [
"node_modules", "node_modules",