File tree Expand file tree Collapse file tree 3 files changed +54
-5
lines changed Expand file tree Collapse file tree 3 files changed +54
-5
lines changed Original file line number Diff line number Diff line change 1+ <script >
2+ 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+ },
15+ mounted () {
16+ this .load ();
17+ },
18+ methods: {
19+ load () {
20+ if (this .scriptDom ) {
21+ this .$el .removeChild (this .scriptDom );
22+ }
23+ this .$refs .ins .innerHTML = ' ' ;
24+ window .adsbygoogle = undefined ;
25+ const e = document .createElement (' script' );
26+ e .src = ' https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js' ;
27+ e .async = true ;
28+ this .$el .appendChild (e);
29+ this .scriptDom = e;
30+ (adsbygoogle = window .adsbygoogle || []).push ({});
31+ },
32+ },
33+ render () {
34+ return (
35+ < div id= " google-ads" >
36+ < ins
37+ ref= " ins"
38+ class = " adsbygoogle"
39+ style= " display:block"
40+ data- ad- client= " ca-pub-4801326429087140"
41+ data- ad- slot= " 7647023136"
42+ data- ad- format= " auto"
43+ data- full- width- responsive= " true"
44+ >< / ins>
45+ < / div>
46+ );
47+ },
48+ };
49+ </script >
Original file line number Diff line number Diff line change 11<template >
22 <div class =" markdown api-container" >
3+ <GoogleAds />
34 <slot v-if =" isZhCN" name =" cn" />
45 <slot v-else />
56 </div >
67</template >
78<script >
89import { isZhCN } from ' ../util' ;
10+ import GoogleAds from ' ./GoogleAds' ;
911export default {
12+ components: {
13+ GoogleAds,
14+ },
1015 name: ' Api' ,
1116 inject: {
1217 demoContext: { default: {} },
Original file line number Diff line number Diff line change 3737 s . parentNode . insertBefore ( hm , s ) ;
3838 } ) ( ) ;
3939 </ script >
40- < script
41- data-ad-client ="ca-pub-4801326429087140 "
42- async
43- src ="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js "
44- > </ script >
4540 </ head >
4641
4742 < body >
You can’t perform that action at this time.
0 commit comments