Skip to content

Commit c4bac70

Browse files
committed
update site
1 parent 548f10d commit c4bac70

File tree

7 files changed

+62
-27
lines changed

7 files changed

+62
-27
lines changed

site/components/CarbonAds.vue

+2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export default {
6262
#carbon-ads {
6363
width: 280px;
6464
float: right;
65+
margin-top: 75px;
6566
position: relative;
6667
right: 0;
6768
bottom: 0;
@@ -115,6 +116,7 @@ export default {
115116
bottom: 0;
116117
padding: 0;
117118
margin-bottom: 15px;
119+
margin-top: 5px;
118120
.carbon-img {
119121
float: left;
120122
margin-right: 10px;

site/components/GoogleAds.vue

+2-15
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
<script>
22
export default {
3-
props: {
4-
isMobile: Boolean,
5-
},
6-
watch: {
7-
$route(e, t) {
8-
if (e.path !== t.path && this.$refs.ins && this.$refs.ins.innerHTML) {
9-
this.$nextTick(() => {
10-
this.load();
11-
});
12-
}
13-
},
14-
},
153
mounted() {
164
this.load();
175
},
@@ -21,18 +9,17 @@ export default {
219
this.$el.removeChild(this.scriptDom);
2210
}
2311
this.$refs.ins.innerHTML = '';
24-
window.adsbygoogle = undefined;
2512
const e = document.createElement('script');
2613
e.src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js';
2714
e.async = true;
2815
this.$el.appendChild(e);
2916
this.scriptDom = e;
30-
(adsbygoogle = window.adsbygoogle || []).push({});
17+
(window.adsbygoogle = window.adsbygoogle || []).push({});
3118
},
3219
},
3320
render() {
3421
return (
35-
<div id="google-ads">
22+
<div class="google-ads">
3623
<ins
3724
ref="ins"
3825
class="adsbygoogle"

site/components/GoogleAdsTop.vue

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<script>
2+
export default {
3+
mounted() {
4+
this.load();
5+
},
6+
methods: {
7+
load() {
8+
if (this.scriptDom) {
9+
this.$el.removeChild(this.scriptDom);
10+
}
11+
this.$refs.ins.innerHTML = '';
12+
const e = document.createElement('script');
13+
e.src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js';
14+
e.async = true;
15+
this.$el.appendChild(e);
16+
this.scriptDom = e;
17+
(window.adsbygoogle = window.adsbygoogle || []).push({});
18+
},
19+
},
20+
render() {
21+
return (
22+
<div class="google-ads">
23+
<ins
24+
ref="ins"
25+
class="adsbygoogle"
26+
style="display:inline-block;width:728px;height:90px"
27+
data-ad-client="ca-pub-4801326429087140"
28+
data-ad-slot="2425414214"
29+
></ins>
30+
</div>
31+
);
32+
},
33+
};
34+
</script>

site/components/geektime.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
href="https://time.geekbang.org/course/intro/163?code=KHKYcoBU6vZa8nMglg7AWfDxxi3BWrz9INAzAY3umPk%3D"
55
target="_blank"
66
>
7-
<img width="170" alt="Vue 实战教程" src="https://qn.antdv.com/geektime-vue.jpeg" />
7+
<img width="150" alt="Vue 实战教程" src="https://qn.antdv.com/geektime-vue.jpeg" />
88
</a>
9-
<div v-if="isMobile" class="close" @click="visible = false">
9+
<div class="close" @click="visible = false">
1010
<a-icon type="close" />
1111
</div>
1212
</div>
@@ -26,8 +26,8 @@ export default {
2626
<style lang="less" scoped>
2727
#geektime {
2828
position: fixed;
29-
bottom: 15px;
30-
right: 15px;
29+
bottom: 10px;
30+
right: 10px;
3131
.close {
3232
position: absolute;
3333
text-align: center;

site/components/layout.vue

+7-5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import { isZhCN } from '../util';
1414
import { Provider, create } from '../../components/_util/store';
1515
import NProgress from 'nprogress';
1616
import MobileMenu from '../../components/vc-drawer/src';
17+
import GoogleAdsTop from './GoogleAdsTop';
18+
import GoogleAds from './GoogleAds';
1719
1820
const docsList = [
1921
{ key: 'introduce', enTitle: 'Ant Design of Vue', title: 'Ant Design of Vue' },
@@ -129,11 +131,9 @@ export default {
129131
const title = isCN ? cnTitle : usTitle;
130132
lis.push(<a-anchor-link key={id} href={`#${id}`} title={title} />);
131133
});
132-
const showApi = this.$route.path.indexOf('/components/') !== -1;
133134
return (
134135
<a-anchor offsetTop={100} class="demo-anchor">
135136
{lis}
136-
{showApi ? <a-anchor-link key="API" title="API" href="#API" /> : ''}
137137
</a-anchor>
138138
);
139139
},
@@ -240,7 +240,7 @@ export default {
240240
}
241241
const config = AllDemo[titleMap[reName]];
242242
this.resetDocumentTitle(config, reName, isCN);
243-
const { isMobile } = this;
243+
const { isMobile, $route } = this;
244244
return (
245245
<div class="page-wrapper">
246246
<Header searchData={searchData} name={name} />
@@ -294,10 +294,11 @@ export default {
294294
)}
295295
<a-col xxl={20} xl={19} lg={19} md={18} sm={24} xs={24}>
296296
<section class="main-container main-container-component">
297-
<CarbonAds isMobile={isMobile} />
297+
<GoogleAdsTop key={`GoogleAdsTop_${$route.path}`} />
298+
{!isMobile ? <CarbonAds /> : null}
298299
<GeektimeAds isMobile={isMobile} />
299300
{!isMobile ? (
300-
<div class="toc-affix" style="width: 150px;">
301+
<div class={['toc-affix', isCN ? 'toc-affix-cn' : '']} style="width: 150px;">
301302
{this.getSubMenu(isCN)}
302303
</div>
303304
) : null}
@@ -330,6 +331,7 @@ export default {
330331
],
331332
}}
332333
></router-view>
334+
<GoogleAds key={`GoogleAds_${$route.path}`} />
333335
</div>
334336
) : (
335337
''

site/index.html

+11
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,17 @@
4343
<div id="app">
4444
<router-view></router-view>
4545
</div>
46+
<!-- Global site tag (gtag.js) - Google Analytics -->
47+
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-151755889-1"></script>
48+
<script>
49+
window.dataLayer = window.dataLayer || [];
50+
function gtag() {
51+
dataLayer.push(arguments);
52+
}
53+
gtag('js', new Date());
54+
55+
gtag('config', 'UA-151755889-1');
56+
</script>
4657
<!-- Hotjar Tracking Code for http://vue.ant.design -->
4758
<script>
4859
(function(h, o, t, j, a, r) {

site/index.less

+2-3
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,9 @@ pre > code[class*='language-'] {
185185
position: fixed;
186186
top: 100px;
187187
right: 10px;
188-
bottom: 250px;
189188
}
190-
.toc-affix .ant-anchor-wrapper {
191-
max-height: calc(~'100vh - 400px') !important;
189+
.toc-affix-cn .ant-anchor-wrapper {
190+
max-height: calc(~'100vh - 330px') !important;
192191
}
193192

194193
.drawer-wrapper .drawer-content {

0 commit comments

Comments
 (0)