update site
parent
52b66db19a
commit
1fd1735cb7
|
@ -0,0 +1,49 @@
|
||||||
|
<script>
|
||||||
|
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() {
|
||||||
|
this.load();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
load() {
|
||||||
|
if (this.scriptDom) {
|
||||||
|
this.$el.removeChild(this.scriptDom);
|
||||||
|
}
|
||||||
|
this.$refs.ins.innerHTML = '';
|
||||||
|
window.adsbygoogle = undefined;
|
||||||
|
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;
|
||||||
|
(adsbygoogle = window.adsbygoogle || []).push({});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div id="google-ads">
|
||||||
|
<ins
|
||||||
|
ref="ins"
|
||||||
|
class="adsbygoogle"
|
||||||
|
style="display:block"
|
||||||
|
data-ad-client="ca-pub-4801326429087140"
|
||||||
|
data-ad-slot="7647023136"
|
||||||
|
data-ad-format="auto"
|
||||||
|
data-full-width-responsive="true"
|
||||||
|
></ins>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
|
@ -1,12 +1,17 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="markdown api-container">
|
<div class="markdown api-container">
|
||||||
|
<GoogleAds />
|
||||||
<slot v-if="isZhCN" name="cn" />
|
<slot v-if="isZhCN" name="cn" />
|
||||||
<slot v-else />
|
<slot v-else />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { isZhCN } from '../util';
|
import { isZhCN } from '../util';
|
||||||
|
import GoogleAds from './GoogleAds';
|
||||||
export default {
|
export default {
|
||||||
|
components: {
|
||||||
|
GoogleAds,
|
||||||
|
},
|
||||||
name: 'Api',
|
name: 'Api',
|
||||||
inject: {
|
inject: {
|
||||||
demoContext: { default: {} },
|
demoContext: { default: {} },
|
||||||
|
|
|
@ -37,11 +37,6 @@
|
||||||
s.parentNode.insertBefore(hm, s);
|
s.parentNode.insertBefore(hm, s);
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
<script
|
|
||||||
data-ad-client="ca-pub-4801326429087140"
|
|
||||||
async
|
|
||||||
src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"
|
|
||||||
></script>
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
Loading…
Reference in New Issue