From c8160867bee692129effbf0b448125c1f7121766 Mon Sep 17 00:00:00 2001
From: tangjinzhou <415800467@qq.com>
Date: Wed, 26 Feb 2020 17:20:49 +0800
Subject: [PATCH] docs: updatedoc
---
build/dev.js | 4 ++-
components/tree/demo/index.vue | 22 +++++++-------
site/components/api.vue | 2 +-
site/components/demoBox.vue | 1 +
site/components/demoSort.jsx | 49 +++++++++++++++++++++++++++++++
site/components/layout.vue | 6 +---
site/index.js | 2 ++
site/theme/static/responsive.less | 2 +-
8 files changed, 70 insertions(+), 18 deletions(-)
create mode 100644 site/components/demoSort.jsx
diff --git a/build/dev.js b/build/dev.js
index 0d0a3e0d8..3f64931a0 100644
--- a/build/dev.js
+++ b/build/dev.js
@@ -28,7 +28,6 @@ let { componentName } = require('./config').dev;
const componentsInPrototype = ['Modal', 'message', 'notification'];
const MAIN_TEMPLATE = `import 'babel-polyfill';
-import './index.less';
import 'highlight.js/styles/solarized-light.css';
import Vue from 'vue';
import Vuex from 'vuex';
@@ -38,6 +37,7 @@ import VueClipboard from 'vue-clipboard2';
import Md from './components/md';
import Api from './components/api';
import demoBox from './components/demoBox';
+import demoSort from './components/demoSort';
import demoContainer from './components/demoContainer';
import Modal from '../components/modal';
import message from '../components/message';
@@ -50,6 +50,7 @@ import '../components/notification/style';
import Test from '../components/{{name}}/demo/index.vue';
import zhCN from './theme/zh-CN';
import enUS from './theme/en-US';
+import './index.less';
Vue.use(Vuex);
Vue.use(VueClipboard);
@@ -58,6 +59,7 @@ Vue.use(VueI18n);
Vue.component(Md.name, Md);
Vue.component(Api.name, Api);
Vue.component('demo-box', demoBox);
+Vue.component('demo-sort', demoSort);
Vue.component('demo-container', demoContainer);
Vue.prototype.$message = message;
diff --git a/components/tree/demo/index.vue b/components/tree/demo/index.vue
index 246c0c1d5..64320521f 100644
--- a/components/tree/demo/index.vue
+++ b/components/tree/demo/index.vue
@@ -37,16 +37,18 @@ export default {
return (
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/site/components/api.vue b/site/components/api.vue
index b6f6c31c7..d563029b2 100644
--- a/site/components/api.vue
+++ b/site/components/api.vue
@@ -9,10 +9,10 @@
import { isZhCN } from '../util';
import GoogleAds from './GoogleAds';
export default {
+ name: 'Api',
components: {
GoogleAds,
},
- name: 'Api',
inject: {
demoContext: { default: {} },
},
diff --git a/site/components/demoBox.vue b/site/components/demoBox.vue
index 095cf4d5d..15143cd14 100644
--- a/site/components/demoBox.vue
+++ b/site/components/demoBox.vue
@@ -106,6 +106,7 @@ export default {
sourceCode,
id,
iframeDemoKey,
+ isDemo: true,
};
},
methods: {
diff --git a/site/components/demoSort.jsx b/site/components/demoSort.jsx
new file mode 100644
index 000000000..af20ab57f
--- /dev/null
+++ b/site/components/demoSort.jsx
@@ -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 (
+
+
+ {leftChildren}
+
+ {isSingleCol ? null : (
+
+ {rightChildren}
+
+ )}
+
+ );
+ },
+};
diff --git a/site/components/layout.vue b/site/components/layout.vue
index 2a18527f9..226002454 100644
--- a/site/components/layout.vue
+++ b/site/components/layout.vue
@@ -29,11 +29,7 @@ const docsList = [
{ key: 'download', enTitle: 'Download Design Resources', title: '下载设计资源' },
];
-let isMobile = false;
const isGitee = window.location.host.indexOf('gitee.io') > -1;
-enquireScreen(b => {
- isMobile = b;
-});
const showAd = location.host.indexOf('antdv.com') > -1;
export default {
props: {
@@ -50,7 +46,7 @@ export default {
showSideBars: true,
currentSubMenu: [],
sidebarHeight: document.documentElement.offsetHeight,
- isMobile,
+ isMobile: false,
};
},
provide() {
diff --git a/site/index.js b/site/index.js
index 1f5f476e6..f68098456 100644
--- a/site/index.js
+++ b/site/index.js
@@ -15,6 +15,7 @@ import Api from './components/api';
import './components';
import demoBox from './components/demoBox';
import demoContainer from './components/demoContainer';
+import demoSort from './components/demoSort';
import zhCN from './theme/zh-CN';
import enUS from './theme/en-US';
import { isZhCN } from './util';
@@ -38,6 +39,7 @@ Vue.component(Md.name, Md);
Vue.component(Api.name, Api);
Vue.component('demo-box', demoBox);
Vue.component('demo-container', demoContainer);
+Vue.component('demo-sort', demoSort);
const i18n = new VueI18n({
locale: isZhCN(location.pathname) ? zhCN.locale : enUS.locale,
diff --git a/site/theme/static/responsive.less b/site/theme/static/responsive.less
index bce3bbbbb..216a02a61 100644
--- a/site/theme/static/responsive.less
+++ b/site/theme/static/responsive.less
@@ -28,7 +28,7 @@
}
}
-@media only screen and (max-width: 767.99px) {
+@media only screen and (max-width: 992px) {
#header {
text-align: center;
#logo {