update site

pull/422/head
tangjinzhou 2019-01-16 13:24:47 +08:00
parent d41c7dbbcd
commit f05387d372
4 changed files with 49 additions and 39 deletions

View File

@ -7,6 +7,7 @@ import Sponsors from './sponsors';
import zhCN from 'antd/locale-provider/zh_CN'; import zhCN from 'antd/locale-provider/zh_CN';
import enUS from 'antd/locale-provider/default'; import enUS from 'antd/locale-provider/default';
import sortBy from 'lodash/sortBy'; import sortBy from 'lodash/sortBy';
import axios from 'axios';
import { isZhCN } from '../util'; import { isZhCN } from '../util';
import { Provider, create } from '../../components/_util/store'; import { Provider, create } from '../../components/_util/store';
import NProgress from 'nprogress'; import NProgress from 'nprogress';
@ -156,13 +157,22 @@ export default {
NProgress.done(); NProgress.done();
document.documentElement.scrollTop = 0; document.documentElement.scrollTop = 0;
try { try {
document.getElementById('ad').innerHTML = ''; const isGithub = location.host.indexOf('github') !== -1;
const src = '//cdn.carbonads.com/carbon.js?serve=CK7DL2JW&placement=vuecomponentgithubio'; if(isGithub){
const hm = document.createElement('script'); document.getElementById('ad').innerHTML = '';
hm.src = src; const src = '//cdn.carbonads.com/carbon.js?serve=CK7DL2JW&placement=vuecomponentgithubio';
hm.id = '_carbonads_js'; const hm = document.createElement('script');
const s = document.getElementById('ad'); hm.src = src;
s.append(hm); hm.id = '_carbonads_js';
const s = document.getElementById('ad');
s.append(hm);
} else {
axios.get('https://api.codefund.app/properties/162/funder.html?template=square')
.then(function (response) {
document.getElementById("codefund").innerHTML = response.data;
});
}
} catch (error) {} } catch (error) {}
}, },
}, },

View File

@ -17,7 +17,7 @@
} }
</style> </style>
<style> <style>
#ad { #ad, #codefund {
width: 145px; width: 145px;
position: fixed; position: fixed;
bottom: 10px; bottom: 10px;
@ -28,16 +28,24 @@
font-size: 13px; font-size: 13px;
font-family: "Source Sans Pro", "Helvetica Neue", Arial, sans-serif; font-family: "Source Sans Pro", "Helvetica Neue", Arial, sans-serif;
} }
#ad a { #ad a, #codefund a {
display: inline-block; display: inline-block;
color: #7f8c8d; color: #7f8c8d;
font-weight: normal; font-weight: normal;
} }
#codefund a {
color: #7f8c8d !important;
font-weight: normal !important;
}
#ad span { #ad span {
color: #7f8c8d; color: #7f8c8d;
display: inline-block; display: inline-block;
margin-bottom: 5px; margin-bottom: 5px;
} }
#codefund #cf {
margin-bottom: 0px!important;
border-radius: 0px!important;
}
#ad img { #ad img {
width: 125px; width: 125px;
} }
@ -48,9 +56,21 @@
font-weight: normal; font-weight: normal;
color: #34495e; color: #34495e;
} }
#ad .carbon-poweredby { #ad .carbon-text,
color: #aaa; #codefund .cf-text {
font-weight: normal; display: -webkit-box!important;
-webkit-box-orient: vertical!important;
-webkit-line-clamp: 4!important;
overflow: hidden!important;
}
#codefund .cf-text {
padding-bottom: 5px !important;
font-size: 12px !important;
}
#ad .carbon-poweredby, #codefund .cf-powered-by {
color: #aaa !important;
font-weight: normal !important;
line-height: 1.2 !important;
} }
</style> </style>
<script> <script>
@ -74,6 +94,7 @@
<div id="ad"> <div id="ad">
<!-- <script async type="text/javascript" src="//cdn.carbonads.com/carbon.js?serve=CK7DL2JW&placement=vuecomponentgithubio" id="_carbonads_js"></script> --> <!-- <script async type="text/javascript" src="//cdn.carbonads.com/carbon.js?serve=CK7DL2JW&placement=vuecomponentgithubio" id="_carbonads_js"></script> -->
</div> </div>
<div id="codefund"></div>
<script> <script>
// var SeedAndDewConfig = {}; // var SeedAndDewConfig = {};
// (function() { // (function() {

View File

@ -7,6 +7,7 @@ import Vue from 'vue';
import VueI18n from 'vue-i18n'; import VueI18n from 'vue-i18n';
import VueRouter from 'vue-router'; import VueRouter from 'vue-router';
import VueClipboard from 'vue-clipboard2'; import VueClipboard from 'vue-clipboard2';
import NProgress from 'nprogress';
import routes from './routes'; import routes from './routes';
import Md from './components/md'; import Md from './components/md';
import Api from './components/api'; import Api from './components/api';
@ -49,6 +50,10 @@ const router = new VueRouter({
fallback: false, fallback: false,
routes, routes,
}); });
router.beforeEach((to, from, next) => {
NProgress.start();
next();
});
new Vue({ new Vue({
el: '#app', el: '#app',
i18n, i18n,

View File

@ -1,12 +1,7 @@
import Layout from './components/layout.vue'; import Layout from './components/layout.vue';
import Iframe from './components/iframe.vue'; import Iframe from './components/iframe.vue';
import demoRoutes from './demoRoutes'; import demoRoutes from './demoRoutes';
import NProgress from 'nprogress';
const beforeEnter = (to, from, next) => {
NProgress.start();
next();
};
export default [ export default [
{ {
path: '/ant-design-vue/components', path: '/ant-design-vue/components',
@ -15,10 +10,7 @@ export default [
const name = route.path.split('/ant-design-vue/components/')[1].split('/')[0]; const name = route.path.split('/ant-design-vue/components/')[1].split('/')[0];
return { name, showDemo: true }; return { name, showDemo: true };
}, },
children: demoRoutes.map(item => ({ children: demoRoutes,
...item,
beforeEnter,
})),
}, },
{ {
path: '/ant-design-vue/iframe', path: '/ant-design-vue/iframe',
@ -42,92 +34,74 @@ export default [
{ {
path: 'docs/vue/customize-theme', path: 'docs/vue/customize-theme',
component: () => import('../docs/vue/customize-theme.en-US.md'), component: () => import('../docs/vue/customize-theme.en-US.md'),
beforeEnter,
}, },
{ {
path: 'docs/vue/customize-theme-cn', path: 'docs/vue/customize-theme-cn',
component: () => import('../docs/vue/customize-theme.zh-CN.md'), component: () => import('../docs/vue/customize-theme.zh-CN.md'),
beforeEnter,
}, },
{ {
path: 'docs/vue/getting-started', path: 'docs/vue/getting-started',
component: () => import('../docs/vue/getting-started.en-US.md'), component: () => import('../docs/vue/getting-started.en-US.md'),
beforeEnter,
}, },
{ {
path: 'docs/vue/getting-started-cn', path: 'docs/vue/getting-started-cn',
component: () => import('../docs/vue/getting-started.zh-CN.md'), component: () => import('../docs/vue/getting-started.zh-CN.md'),
beforeEnter,
}, },
{ {
path: 'docs/vue/i18n', path: 'docs/vue/i18n',
component: () => import('../docs/vue/i18n.en-US.md'), component: () => import('../docs/vue/i18n.en-US.md'),
beforeEnter,
}, },
{ {
path: 'docs/vue/i18n-cn', path: 'docs/vue/i18n-cn',
component: () => import('../docs/vue/i18n.zh-CN.md'), component: () => import('../docs/vue/i18n.zh-CN.md'),
beforeEnter,
}, },
{ {
path: 'docs/vue/introduce', path: 'docs/vue/introduce',
component: () => import('../docs/vue/introduce.en-US.md'), component: () => import('../docs/vue/introduce.en-US.md'),
beforeEnter,
}, },
{ {
path: 'docs/vue/introduce-cn', path: 'docs/vue/introduce-cn',
component: () => import('../docs/vue/introduce.zh-CN.md'), component: () => import('../docs/vue/introduce.zh-CN.md'),
beforeEnter,
}, },
{ {
path: 'docs/vue/use-with-vue-cli', path: 'docs/vue/use-with-vue-cli',
component: () => import('../docs/vue/use-with-vue-cli.en-US.md'), component: () => import('../docs/vue/use-with-vue-cli.en-US.md'),
beforeEnter,
}, },
{ {
path: 'docs/vue/use-with-vue-cli-cn', path: 'docs/vue/use-with-vue-cli-cn',
component: () => import('../docs/vue/use-with-vue-cli.zh-CN.md'), component: () => import('../docs/vue/use-with-vue-cli.zh-CN.md'),
beforeEnter,
}, },
{ {
path: 'docs/vue/faq', path: 'docs/vue/faq',
component: () => import('../docs/vue/faq.en-US.md'), component: () => import('../docs/vue/faq.en-US.md'),
beforeEnter,
}, },
{ {
path: 'docs/vue/faq-cn', path: 'docs/vue/faq-cn',
component: () => import('../docs/vue/faq.zh-CN.md'), component: () => import('../docs/vue/faq.zh-CN.md'),
beforeEnter,
}, },
{ {
path: 'docs/vue/download', path: 'docs/vue/download',
component: () => import('../docs/vue/download.en-US.md'), component: () => import('../docs/vue/download.en-US.md'),
beforeEnter,
}, },
{ {
path: 'docs/vue/download-cn', path: 'docs/vue/download-cn',
component: () => import('../docs/vue/download.zh-CN.md'), component: () => import('../docs/vue/download.zh-CN.md'),
beforeEnter,
}, },
{ {
path: 'docs/vue/sponsor', path: 'docs/vue/sponsor',
component: () => import('../docs/vue/sponsor.en-US.md'), component: () => import('../docs/vue/sponsor.en-US.md'),
beforeEnter,
}, },
{ {
path: 'docs/vue/sponsor-cn', path: 'docs/vue/sponsor-cn',
component: () => import('../docs/vue/sponsor.zh-CN.md'), component: () => import('../docs/vue/sponsor.zh-CN.md'),
beforeEnter,
}, },
{ {
path: 'docs/vue/changelog', path: 'docs/vue/changelog',
component: () => import('../CHANGELOG.en-US.md'), component: () => import('../CHANGELOG.en-US.md'),
beforeEnter,
}, },
{ {
path: 'docs/vue/changelog-cn', path: 'docs/vue/changelog-cn',
component: () => import('../CHANGELOG.zh-CN.md'), component: () => import('../CHANGELOG.zh-CN.md'),
beforeEnter,
}, },
{ path: '', redirect: '/ant-design-vue/vue/docs/introduce/' }, { path: '', redirect: '/ant-design-vue/vue/docs/introduce/' },
], ],