docs: updatedoc

pull/1845/head
tangjinzhou 2020-02-26 17:20:49 +08:00
parent fce18564ca
commit c8160867be
8 changed files with 70 additions and 18 deletions

View File

@ -28,7 +28,6 @@ let { componentName } = require('./config').dev;
const componentsInPrototype = ['Modal', 'message', 'notification']; const componentsInPrototype = ['Modal', 'message', 'notification'];
const MAIN_TEMPLATE = `import 'babel-polyfill'; const MAIN_TEMPLATE = `import 'babel-polyfill';
import './index.less';
import 'highlight.js/styles/solarized-light.css'; import 'highlight.js/styles/solarized-light.css';
import Vue from 'vue'; import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
@ -38,6 +37,7 @@ import VueClipboard from 'vue-clipboard2';
import Md from './components/md'; import Md from './components/md';
import Api from './components/api'; import Api from './components/api';
import demoBox from './components/demoBox'; import demoBox from './components/demoBox';
import demoSort from './components/demoSort';
import demoContainer from './components/demoContainer'; import demoContainer from './components/demoContainer';
import Modal from '../components/modal'; import Modal from '../components/modal';
import message from '../components/message'; import message from '../components/message';
@ -50,6 +50,7 @@ import '../components/notification/style';
import Test from '../components/{{name}}/demo/index.vue'; import Test from '../components/{{name}}/demo/index.vue';
import zhCN from './theme/zh-CN'; import zhCN from './theme/zh-CN';
import enUS from './theme/en-US'; import enUS from './theme/en-US';
import './index.less';
Vue.use(Vuex); Vue.use(Vuex);
Vue.use(VueClipboard); Vue.use(VueClipboard);
@ -58,6 +59,7 @@ Vue.use(VueI18n);
Vue.component(Md.name, Md); Vue.component(Md.name, Md);
Vue.component(Api.name, Api); Vue.component(Api.name, Api);
Vue.component('demo-box', demoBox); Vue.component('demo-box', demoBox);
Vue.component('demo-sort', demoSort);
Vue.component('demo-container', demoContainer); Vue.component('demo-container', demoContainer);
Vue.prototype.$message = message; Vue.prototype.$message = message;

View File

@ -37,16 +37,18 @@ export default {
return ( return (
<div> <div>
<md cn={md.cn} us={md.us} /> <md cn={md.cn} us={md.us} />
<BasicControlled /> <demo-sort cols="2">
<Basic /> <BasicControlled />
<ReplaceFields /> <Basic />
<CustomizedIcon /> <ReplaceFields />
<Draggable /> <CustomizedIcon />
<Dynamic /> <Draggable />
<Line /> <Dynamic />
<Search /> <Line />
<Directory /> <Search />
<SwitcherIcon /> <Directory />
<SwitcherIcon />
</demo-sort>
<api> <api>
<template slot="cn"> <template slot="cn">
<CN /> <CN />

View File

@ -9,10 +9,10 @@
import { isZhCN } from '../util'; import { isZhCN } from '../util';
import GoogleAds from './GoogleAds'; import GoogleAds from './GoogleAds';
export default { export default {
name: 'Api',
components: { components: {
GoogleAds, GoogleAds,
}, },
name: 'Api',
inject: { inject: {
demoContext: { default: {} }, demoContext: { default: {} },
}, },

View File

@ -106,6 +106,7 @@ export default {
sourceCode, sourceCode,
id, id,
iframeDemoKey, iframeDemoKey,
isDemo: true,
}; };
}, },
methods: { methods: {

View File

@ -0,0 +1,49 @@
import { Col, Row } from '../../components/grid';
import '../../components/grid/style';
function isEmptyElement(c) {
return !(c.tag || (c.text && c.text.trim() !== ''));
}
function filterEmpty(children = []) {
return children.filter(c => !isEmptyElement(c));
}
export default {
props: {
cols: {
type: [Number, String],
default: 1,
},
},
inject: {
demoContext: { default: {} },
},
render() {
const { cols, $slots } = this;
const isSingleCol = cols === 1;
const leftChildren = [];
const rightChildren = [];
const children = filterEmpty($slots.default);
children.forEach((demo, index) => {
if (index % 2 === 0 || isSingleCol) {
leftChildren.push(demo);
} else {
rightChildren.push(demo);
}
});
return (
<Row gutter={16}>
<Col
span={isSingleCol ? 24 : 12}
class={isSingleCol ? 'code-boxes-col-1-1' : 'code-boxes-col-2-1'}
>
{leftChildren}
</Col>
{isSingleCol ? null : (
<Col class="code-boxes-col-2-1" span={12}>
{rightChildren}
</Col>
)}
</Row>
);
},
};

View File

@ -29,11 +29,7 @@ const docsList = [
{ key: 'download', enTitle: 'Download Design Resources', title: '下载设计资源' }, { key: 'download', enTitle: 'Download Design Resources', title: '下载设计资源' },
]; ];
let isMobile = false;
const isGitee = window.location.host.indexOf('gitee.io') > -1; const isGitee = window.location.host.indexOf('gitee.io') > -1;
enquireScreen(b => {
isMobile = b;
});
const showAd = location.host.indexOf('antdv.com') > -1; const showAd = location.host.indexOf('antdv.com') > -1;
export default { export default {
props: { props: {
@ -50,7 +46,7 @@ export default {
showSideBars: true, showSideBars: true,
currentSubMenu: [], currentSubMenu: [],
sidebarHeight: document.documentElement.offsetHeight, sidebarHeight: document.documentElement.offsetHeight,
isMobile, isMobile: false,
}; };
}, },
provide() { provide() {

View File

@ -15,6 +15,7 @@ import Api from './components/api';
import './components'; import './components';
import demoBox from './components/demoBox'; import demoBox from './components/demoBox';
import demoContainer from './components/demoContainer'; import demoContainer from './components/demoContainer';
import demoSort from './components/demoSort';
import zhCN from './theme/zh-CN'; import zhCN from './theme/zh-CN';
import enUS from './theme/en-US'; import enUS from './theme/en-US';
import { isZhCN } from './util'; import { isZhCN } from './util';
@ -38,6 +39,7 @@ Vue.component(Md.name, Md);
Vue.component(Api.name, Api); Vue.component(Api.name, Api);
Vue.component('demo-box', demoBox); Vue.component('demo-box', demoBox);
Vue.component('demo-container', demoContainer); Vue.component('demo-container', demoContainer);
Vue.component('demo-sort', demoSort);
const i18n = new VueI18n({ const i18n = new VueI18n({
locale: isZhCN(location.pathname) ? zhCN.locale : enUS.locale, locale: isZhCN(location.pathname) ? zhCN.locale : enUS.locale,

View File

@ -28,7 +28,7 @@
} }
} }
@media only screen and (max-width: 767.99px) { @media only screen and (max-width: 992px) {
#header { #header {
text-align: center; text-align: center;
#logo { #logo {