mirror of
https://gitcode.com/huyuchengus/gitcode_knowledge.git
synced 2025-07-14 04:33:29 +00:00
备份博文内容
This commit is contained in:
parent
83d8c10afc
commit
a4426c85d1
1
CSDN博文备份/VueGoogle广告的配置-143066260.md
Normal file
1
CSDN博文备份/VueGoogle广告的配置-143066260.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
<p>前置条件:已经在<a href="https://www.google.com/adsense/new/u/0/pub-4778994220547248/sites/list" rel="nofollow" title="Google AdSense">Google AdSense</a> 中 添加网站 并通过审核 同时已创建广告单元。</p> <br><p>因 VUE 的 Script 配置问题,所以不能直接拷贝内容。</p> <br><h3>index.html 配置</h3> <br><p>添加 Google 广告的脚本。</p> <br><p></p> <br><pre><code>//index.template.html<br>/* *<br>在head标签中添加 script<br>【 **** 】:你的发布商 ID<br>*/<br> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4797644559430915"<br> crossorigin="anonymous"></script><br></code></pre> <br><p></p> <br><pre><code>//index.template.html<br>//在body标签中为window添加函数<br><body><br> <br> <div id="q-app"></div><br><br><script><br> window['googlAdsense'] = function () {<br> let chlid = document.getElementsByClassName('google-adsense-slot')<br> for (let index = 0; index < chlid.length; index++) {<br> (adsbygoogle = window.adsbygoogle || []).push({});<br> }<br> }<br></script><br></body><br></code></pre> <br><p></p> <br><p></p> <br><p class="img-center"><a href="https://cdn.isharkfly.com/com-isharkfly-www/discourse-uploads/original/2X/5/506dac540483d1d4d467176a55b8b00c97d91de4.png" rel="nofollow"><img alt="2024-10-18_19-58-39" height="355" src="https://img-blog.csdnimg.cn/img_convert/d3c5c96fa03ce2208b41e5f4be9940c7.png" width="690" /></a></p> <br><p></p> <br><p></p> <br><h3>组件中</h3> <br><p>组件中添加应用。</p> <br><p></p> <br><pre><code>onMounted(() => {<br> window.googlAdsense();<br>});<br></code></pre> <br><p></p> <br><p></p> <br><p class="img-center"><a href="https://cdn.isharkfly.com/com-isharkfly-www/discourse-uploads/original/2X/f/feaf9ffa8a5eb5398b8148bf51a57d47ebe8d956.png" rel="nofollow"><img alt="2024-10-18_20-00-52" height="323" src="https://img-blog.csdnimg.cn/img_convert/8c04f58a189329a6b2576e672c373861.png" width="690" /></a></p> <br><p></p> <br><p>为广告添加占位符。</p> <br><p></p> <br><pre><code>//将广告单元代码添加到盒子中<br><template><br> <div class="col google-adsense-slot"><br> <ins<br> class="adsbygoogle"<br> style="display: block"<br> data-ad-client="ca-pub-4797644559430915"<br> data-ad-slot="4417932244"<br> data-ad-format="auto"<br> data-full-width-responsive="true"<br> ></ins><br> </div><br></template><br></code></pre> <br><p></p> <br><p></p> <br><p class="img-center"><a href="https://cdn.isharkfly.com/com-isharkfly-www/discourse-uploads/original/2X/b/b4ecfc54e90de4d71a813b490cc7a8ed85bf9a57.png" rel="nofollow"><img alt="2024-10-18_20-00-16" height="328" src="https://img-blog.csdnimg.cn/img_convert/a1fa7070eae635321c4ff1806609e8c2.png" width="690" /></a></p> <br><p><a href="https://www.isharkfly.com/t/vue-google/16438/1" rel="nofollow" title="https://www.isharkfly.com/t/vue-google/16438/1">https://www.isharkfly.com/t/vue-google/16438/1</a></p> <br><p></p>
|
Loading…
x
Reference in New Issue
Block a user