From a4426c85d1f9ca5bd6f8adda88d5d911d8f991f0 Mon Sep 17 00:00:00 2001 From: huyuchengus Date: Sat, 19 Oct 2024 08:55:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=87=E4=BB=BD=E5=8D=9A=E6=96=87=E5=86=85?= =?UTF-8?q?=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CSDN博文备份/VueGoogle广告的配置-143066260.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 CSDN博文备份/VueGoogle广告的配置-143066260.md 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 配置问题,所以不能直接拷贝内容。


index.html 配置


添加 Google 广告的脚本。



//index.template.html
/* *
在head标签中添加 script
【 **** 】:你的发布商 ID
*/



//index.template.html
//在body标签中为window添加函数









2024-10-18_19-58-39




组件中


组件中添加应用。



onMounted(() => {
window.googlAdsense();
});



2024-10-18_20-00-52



为广告添加占位符。



//将广告单元代码添加到盒子中




2024-10-18_20-00-16


https://www.isharkfly.com/t/vue-google/16438/1


\ No newline at end of file