提交 08d1950f 编写于 作者: H hdx

ad-interstitial:补充详细API示例

上级 c4ff8542
......@@ -94,6 +94,47 @@ export default {
</script>
```
API示例
```html
<template>
<view>
<ad-interstitial ref="adInterstitial" adpid="1111111113" :loadnext="false" v-slot:default="{loading, error}" @load="onadload" @close="onadclose" @error="onaderror">
<view v-if="error">{{error}}</view>
</ad-interstitial>
<button type="primary" :disabled="isLoading" :loading="isLoading" @click="showAd">显示广告</button>
</view>
</template>
<script>
export default {
data() {
return {
isLoading: false
}
},
methods: {
showAd() {
this.isLoading = true;
this.$refs.adInterstitial.show();
},
onadload(e) {
this.isLoading = false;
console.log('广告数据加载成功');
},
onadclose(e) {
// 用户点击了关闭广告
console.log("onadclose",e);
},
onaderror(e) {
// 广告加载失败
console.log("onaderror: ", e.detail);
}
}
}
</script>
```
**注意**
- 微信小程序插屏广告触发频率限制:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册