diff --git a/CSDN博文备份/VueGoogle广告的配置-143066260.md b/CSDN博文备份/VueGoogle广告的配置-143066260.md new file mode 100644 index 0000000..25562d7 --- /dev/null +++ b/CSDN博文备份/VueGoogle广告的配置-143066260.md @@ -0,0 +1 @@ +
前置条件:已经在Google AdSense 中 添加网站 并通过审核 同时已创建广告单元。
因 VUE 的 Script 配置问题,所以不能直接拷贝内容。
添加 Google 广告的脚本。
//index.template.html
/* *
在head标签中添加 script
【 **** 】:你的发布商 ID
*/
//index.template.html
//在body标签中为window添加函数
组件中添加应用。
onMounted(() => {
window.googlAdsense();
});
为广告添加占位符。
//将广告单元代码添加到盒子中
class="adsbygoogle"
style="display: block"
data-ad-client="ca-pub-4797644559430915"
data-ad-slot="4417932244"
data-ad-format="auto"
data-full-width-responsive="true"
>
https://www.isharkfly.com/t/vue-google/16438/1