[Doc] optimize document site (#1013)

This commit is contained in:
neverland
2018-05-08 08:27:52 +08:00
committed by GitHub
parent 883fb78f21
commit 072dc24656
8 changed files with 51 additions and 85 deletions
+2 -20
View File
@@ -28,6 +28,7 @@ const install = Vue => {
});
};
/* istanbul ignore if */
if (typeof window !== 'undefined' && window.Vue) {
install(window.Vue);
}
@@ -55,26 +56,7 @@ function buildDemoEntry() {
.map(name => `'${name}': asyncWrapper(r => require.ensure([], () => r(componentWrapper(require('./views/${name}'), '${name}')), '${name}'))`);
const content = `${tips}
import './common';
import progress from 'nprogress';
function asyncWrapper(component) {
return function(r) {
progress.start();
component(r).then(() => {
progress.done();
}).catch(() => {
progress.done();
});
};
}
function componentWrapper(component, name) {
component = component.default;
component.name = 'demo-' + name;
return component;
}
import { asyncWrapper, componentWrapper } from './common';
export default {
${demos.join(',\n ')}