提交 ee062a70 编写于 作者: study夏羽's avatar study夏羽

调整ad示例

上级 80e7bb28
......@@ -80,10 +80,10 @@ export default {
},
methods: {
onadload(e) {
console.log("onload");
console.log("onadload",e);
},
onaderror(e) {
console.log("onerror");
console.log("onaderror",e);
}
}
}
......
......@@ -136,7 +136,7 @@
)
},
onload(e) {
console.log("onload");
console.log("onload",e);
},
onerror(e) {
console.log("onerror: " + e.detail.errCode + " message:: " + e.detail.errMsg);
......
......@@ -23,6 +23,7 @@ code|message|
- App端聚合的Sigmob(iOS):[错误码详情](http://docs.sigmob.cn/#/sdk/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98/ios/)
- App端聚合的Sigmob(Android):[错误码详情](http://docs.sigmob.cn/#/sdk/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98/android/)
- App端聚合的快手错误码
|code|message|
|:-:|:-:|
|40001|没有网络|
......
......@@ -71,7 +71,7 @@
```html
<template>
<view class="content">
<ad-fullscreen-video adpid="1507000611" :loadnext="true" v-slot:default="{loading, error}" @load="onload" @close="onclose" @close="onerror">
<ad-fullscreen-video adpid="1507000611" :loadnext="true" v-slot:default="{loading, error}" @load="onadload" @close="onadclose" @error="onaderror">
<button :disabled="loading" :loading="loading">显示广告</button>
<view v-if="error">{{error}}</view>
</ad-fullscreen-video>
......@@ -85,12 +85,13 @@ export default {
}
},
methods: {
onload(e) {
onadload(e) {
console.log('广告数据加载成功');
},
onclose(e) {
onadclose(e) {
console.log("onadclose",e);
},
onerror(e) {
onaderror(e) {
// 广告加载失败
console.log("onerror: ", e.detail);
}
......@@ -101,4 +102,4 @@ export default {
**错误码**
[错误码相关问题排查](https://uniad.dcloud.net.cn/component/ad-error-code)
[错误码相关问题排查](https://uniapp.dcloud.net.cn/component/ad-error-code.html)
......@@ -67,10 +67,13 @@ Grid 广告在创建后会自动拉取广告。开发者可以通过 ad 组件
},
methods: {
adLoad() {
console.log("adLoad",e);
},
adError(e) {
console.log("adError",e);
},
adClose(e) {
console.log("adClose",e);
}
}
}
......
......@@ -72,7 +72,7 @@ HBuilder 基座的测试广告位 `adpid` 为 `1111111113`
```html
<template>
<view class="content">
<ad-interstitial adpid="1111111113" :loadnext="true" v-slot:default="{loading, error}" @load="onload" @close="onclose" @close="onerror">
<ad-interstitial adpid="1111111113" :loadnext="true" v-slot:default="{loading, error}" @load="onadload" @close="onadclose" @error="onaderror">
<button :disabled="loading" :loading="loading">显示广告</button>
<view v-if="error">{{error}}</view>
</ad-interstitial>
......@@ -86,14 +86,15 @@ export default {
}
},
methods: {
onload(e) {
onadload(e) {
console.log('广告数据加载成功');
},
onclose(e) {
onadclose(e) {
console.log("onadclose",e);
},
onerror(e) {
onaderror(e) {
// 广告加载失败
console.log("onerror: ", e.detail);
console.log("onaderror: ", e.detail);
}
}
}
......@@ -102,4 +103,4 @@ export default {
**错误码**
[错误码相关问题排查](https://uniad.dcloud.net.cn/component/ad-error-code)
[错误码相关问题排查](https://uniapp.dcloud.net.cn/component/ad-error-code.html)
......@@ -92,7 +92,7 @@
```html
<template>
<view class="content">
<ad-rewarded-video adpid="1507000611" :loadnext="true" v-slot:default="{loading, error}" @load="onAdLoad" @close="onAdClose" @error="onAdError">
<ad-rewarded-video adpid="1507000611" :loadnext="true" v-slot:default="{loading, error}" @load="onadload" @close="onadclose" @error="onaderror">
<button :disabled="loading" :loading="loading">显示广告</button>
<view v-if="error">{{error}}</view>
</ad-rewarded-video>
......@@ -106,23 +106,23 @@ export default {
}
},
methods: {
onAdLoad(e) {
onadload(e) {
console.log('广告数据加载成功');
},
onAdClose(e) {
onadclose(e) {
const detail = e.detail
// 用户点击了【关闭广告】按钮
if (detail && detail.isEnded) {
// 正常播放结束
console.log("onAdClose " + detail.isEnded);
console.log("onadclose " + detail.isEnded);
} else {
// 播放中途退出
console.log("onClose " + detail.isEnded);
console.log("onadclose " + detail.isEnded);
}
},
onAdError(e) {
onaderror(e) {
// 广告加载失败
console.log("onAdError: ", e.detail);
console.log("onaderror: ", e.detail);
}
}
}
......@@ -134,7 +134,7 @@ export default {
```html
<template>
<view class="content">
<ad-rewarded-video :adpid="adpids" :loadnext="true" v-slot:default="{loading, error}" @load="onAdLoad" @close="onAdClose" @close="onAdError">
<ad-rewarded-video :adpid="adpids" :loadnext="true" v-slot:default="{loading, error}" @load="onadload" @close="onadclose" @error="onaderror">
<button :disabled="loading" :loading="loading">显示广告</button>
<view v-if="error">{{error}}</view>
</ad-rewarded-video>
......@@ -149,23 +149,23 @@ export default {
}
},
methods: {
onAdLoad(e) {
onadload(e) {
console.log('广告数据加载成功');
},
onAdClose(e) {
onadclose(e) {
const detail = e.detail
// 用户点击了【关闭广告】按钮
if (detail && detail.isEnded) {
// 正常播放结束
console.log("onAdClose " + detail.isEnded);
console.log("onadclose " + detail.isEnded);
} else {
// 播放中途退出
console.log("onAdClose " + detail.isEnded);
console.log("onadclose " + detail.isEnded);
}
},
onAdError(e) {
onaderror(e) {
// 广告加载失败
console.log("onAdError: ", e.detail);
console.log("onaderror: ", e.detail);
}
}
}
......@@ -256,7 +256,7 @@ export default {
```html
<template>
<view class="content">
<ad-rewarded-video adpid="1507000611" :loadnext="true" v-slot:default="{loading, error}" @close="onAdClose">
<ad-rewarded-video adpid="1507000611" :loadnext="true" v-slot:default="{loading, error}" @close="onadclose">
<button :disabled="loading" :loading="loading">显示广告</button>
<view v-if="error">{{error}}</view>
</ad-rewarded-video>
......@@ -266,16 +266,16 @@ export default {
<script>
export default {
methods: {
onAdClose(e) {
onadclose(e) {
const detail = e.detail
// 用户点击了【关闭广告】按钮
if (detail && detail.isEnded) {
// 正常播放结束
// 这里应该联网给予用户激励。且这段代码应该做安全保护,详见下文中的“安全注意”
console.log("onAdClose " + detail.isEnded);
console.log("onadclose " + detail.isEnded);
} else {
// 播放中途退出
console.log("onAdClose " + detail.isEnded);
console.log("onadclose " + detail.isEnded);
}
}
}
......
......@@ -287,4 +287,4 @@ export default {
**错误码**
[错误码相关问题排查](https://uniad.dcloud.net.cn/component/ad-error-code)
[错误码相关问题排查](https://uniapp.dcloud.net.cn/component/ad-error-code.html)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册