update site

pull/1396/head^2
tanjinzhou 2019-11-07 17:49:17 +08:00
parent 548f10d357
commit c4bac70e9b
7 changed files with 62 additions and 27 deletions

View File

@ -62,6 +62,7 @@ export default {
#carbon-ads { #carbon-ads {
width: 280px; width: 280px;
float: right; float: right;
margin-top: 75px;
position: relative; position: relative;
right: 0; right: 0;
bottom: 0; bottom: 0;
@ -115,6 +116,7 @@ export default {
bottom: 0; bottom: 0;
padding: 0; padding: 0;
margin-bottom: 15px; margin-bottom: 15px;
margin-top: 5px;
.carbon-img { .carbon-img {
float: left; float: left;
margin-right: 10px; margin-right: 10px;

View File

@ -1,17 +1,5 @@
<script> <script>
export default { export default {
props: {
isMobile: Boolean,
},
watch: {
$route(e, t) {
if (e.path !== t.path && this.$refs.ins && this.$refs.ins.innerHTML) {
this.$nextTick(() => {
this.load();
});
}
},
},
mounted() { mounted() {
this.load(); this.load();
}, },
@ -21,18 +9,17 @@ export default {
this.$el.removeChild(this.scriptDom); this.$el.removeChild(this.scriptDom);
} }
this.$refs.ins.innerHTML = ''; this.$refs.ins.innerHTML = '';
window.adsbygoogle = undefined;
const e = document.createElement('script'); const e = document.createElement('script');
e.src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js'; e.src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js';
e.async = true; e.async = true;
this.$el.appendChild(e); this.$el.appendChild(e);
this.scriptDom = e; this.scriptDom = e;
(adsbygoogle = window.adsbygoogle || []).push({}); (window.adsbygoogle = window.adsbygoogle || []).push({});
}, },
}, },
render() { render() {
return ( return (
<div id="google-ads"> <div class="google-ads">
<ins <ins
ref="ins" ref="ins"
class="adsbygoogle" class="adsbygoogle"

View File

@ -0,0 +1,34 @@
<script>
export default {
mounted() {
this.load();
},
methods: {
load() {
if (this.scriptDom) {
this.$el.removeChild(this.scriptDom);
}
this.$refs.ins.innerHTML = '';
const e = document.createElement('script');
e.src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js';
e.async = true;
this.$el.appendChild(e);
this.scriptDom = e;
(window.adsbygoogle = window.adsbygoogle || []).push({});
},
},
render() {
return (
<div class="google-ads">
<ins
ref="ins"
class="adsbygoogle"
style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-4801326429087140"
data-ad-slot="2425414214"
></ins>
</div>
);
},
};
</script>

View File

@ -4,9 +4,9 @@
href="https://time.geekbang.org/course/intro/163?code=KHKYcoBU6vZa8nMglg7AWfDxxi3BWrz9INAzAY3umPk%3D" href="https://time.geekbang.org/course/intro/163?code=KHKYcoBU6vZa8nMglg7AWfDxxi3BWrz9INAzAY3umPk%3D"
target="_blank" target="_blank"
> >
<img width="170" alt="Vue 实战教程" src="https://qn.antdv.com/geektime-vue.jpeg" /> <img width="150" alt="Vue 实战教程" src="https://qn.antdv.com/geektime-vue.jpeg" />
</a> </a>
<div v-if="isMobile" class="close" @click="visible = false"> <div class="close" @click="visible = false">
<a-icon type="close" /> <a-icon type="close" />
</div> </div>
</div> </div>
@ -26,8 +26,8 @@ export default {
<style lang="less" scoped> <style lang="less" scoped>
#geektime { #geektime {
position: fixed; position: fixed;
bottom: 15px; bottom: 10px;
right: 15px; right: 10px;
.close { .close {
position: absolute; position: absolute;
text-align: center; text-align: center;

View File

@ -14,6 +14,8 @@ 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';
import MobileMenu from '../../components/vc-drawer/src'; import MobileMenu from '../../components/vc-drawer/src';
import GoogleAdsTop from './GoogleAdsTop';
import GoogleAds from './GoogleAds';
const docsList = [ const docsList = [
{ key: 'introduce', enTitle: 'Ant Design of Vue', title: 'Ant Design of Vue' }, { key: 'introduce', enTitle: 'Ant Design of Vue', title: 'Ant Design of Vue' },
@ -129,11 +131,9 @@ export default {
const title = isCN ? cnTitle : usTitle; const title = isCN ? cnTitle : usTitle;
lis.push(<a-anchor-link key={id} href={`#${id}`} title={title} />); lis.push(<a-anchor-link key={id} href={`#${id}`} title={title} />);
}); });
const showApi = this.$route.path.indexOf('/components/') !== -1;
return ( return (
<a-anchor offsetTop={100} class="demo-anchor"> <a-anchor offsetTop={100} class="demo-anchor">
{lis} {lis}
{showApi ? <a-anchor-link key="API" title="API" href="#API" /> : ''}
</a-anchor> </a-anchor>
); );
}, },
@ -240,7 +240,7 @@ export default {
} }
const config = AllDemo[titleMap[reName]]; const config = AllDemo[titleMap[reName]];
this.resetDocumentTitle(config, reName, isCN); this.resetDocumentTitle(config, reName, isCN);
const { isMobile } = this; const { isMobile, $route } = this;
return ( return (
<div class="page-wrapper"> <div class="page-wrapper">
<Header searchData={searchData} name={name} /> <Header searchData={searchData} name={name} />
@ -294,10 +294,11 @@ export default {
)} )}
<a-col xxl={20} xl={19} lg={19} md={18} sm={24} xs={24}> <a-col xxl={20} xl={19} lg={19} md={18} sm={24} xs={24}>
<section class="main-container main-container-component"> <section class="main-container main-container-component">
<CarbonAds isMobile={isMobile} /> <GoogleAdsTop key={`GoogleAdsTop_${$route.path}`} />
{!isMobile ? <CarbonAds /> : null}
<GeektimeAds isMobile={isMobile} /> <GeektimeAds isMobile={isMobile} />
{!isMobile ? ( {!isMobile ? (
<div class="toc-affix" style="width: 150px;"> <div class={['toc-affix', isCN ? 'toc-affix-cn' : '']} style="width: 150px;">
{this.getSubMenu(isCN)} {this.getSubMenu(isCN)}
</div> </div>
) : null} ) : null}
@ -330,6 +331,7 @@ export default {
], ],
}} }}
></router-view> ></router-view>
<GoogleAds key={`GoogleAds_${$route.path}`} />
</div> </div>
) : ( ) : (
'' ''

View File

@ -43,6 +43,17 @@
<div id="app"> <div id="app">
<router-view></router-view> <router-view></router-view>
</div> </div>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-151755889-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'UA-151755889-1');
</script>
<!-- Hotjar Tracking Code for http://vue.ant.design --> <!-- Hotjar Tracking Code for http://vue.ant.design -->
<script> <script>
(function(h, o, t, j, a, r) { (function(h, o, t, j, a, r) {

View File

@ -185,10 +185,9 @@ pre > code[class*='language-'] {
position: fixed; position: fixed;
top: 100px; top: 100px;
right: 10px; right: 10px;
bottom: 250px;
} }
.toc-affix .ant-anchor-wrapper { .toc-affix-cn .ant-anchor-wrapper {
max-height: calc(~'100vh - 400px') !important; max-height: calc(~'100vh - 330px') !important;
} }
.drawer-wrapper .drawer-content { .drawer-wrapper .drawer-content {