mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-14 08:51:28 +08:00
35 lines
816 B
Vue
35 lines
816 B
Vue
<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>
|