功能介绍:Vue项目开发中在指定的地方接入谷歌联盟广告(Google Adsense),下面web建站小编给大家简单介绍一下具体实现代码!
1、在index.html首页加入script通用代码
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js" ></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
2、新建AdComponent.vue通用模板
<template>
<div> //自己的广告联盟
<ins class="adsbygoogle"
style="display:block; text-align:center;"
data-ad-layout="in-article"
data-ad-format="fluid"
data-ad-client="YOUR_AD_CLIENT_ID"
data-ad-slot="YOUR_AD_CLIENT_ID"></ins>
</div>
</template>
<script>
export default {
name: 'AdComponent'
}
</script>
<style scoped>
</style>
3、在需要展示的地方插入
<template>
<div>
<adComponent></adComponent>
</div>
</template>
<script>
import adComponent from '@/components/AdComponent.vue';
export default {
components: {
adComponent
},
}
</script>
vue项目引入谷歌广告报Adsense错误:TagError: adsbygoogle.push() error: All ins elements...解决方法
上面是“Vue项目如何接入谷歌联盟广告(Google Adsense)”的全面内容,想了解更多关于 vuejs 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_14428.html
workflows工作流
一个红头发明亮眼睛的漂亮女人
一只千纸鹤坐在路上哭泣ComfyUI工作流
stvmccrr风格的玫瑰花ComfyUI工作流
3D几何打印人体模型ComfyUI工作流
树上挂着一只快乐香蕉ComfyUI工作流一
一群蜜蜂和一个六边形蜂巢ComfyUI工作流
去掉背景(抠图)comfyui工作流
一个戴着破旧莎草帽的机械忍者
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

用canvas实现画板涂鸦效果
css3实现星球旋转
纯css翻书效果
利用canvas画几个好玩的星云物种
黑客入侵效果代码
利用CSS3代码编写45款按钮效果
css3绘制一个会动的大嘴鸟






