Skip to content

Commit f2d0870

Browse files
committed
update: 激励视频广告 增加loading状态
1 parent 4fe3e37 commit f2d0870

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pages/API/rewarded-video-ad/rewarded-video-ad.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<view>
33
<page-head :title="title"></page-head>
44
<view class="uni-padding-wrap uni-common-mt">
5-
<button type="primary" class="btn" @click="show">显示广告</button>
5+
<button :loading="loading" :disabled="loading" type="primary" class="btn" @click="show">显示广告</button>
66
</view>
77
<!-- #ifndef APP-PLUS -->
88
<view class="ad-tips">
@@ -16,7 +16,8 @@
1616
export default {
1717
data() {
1818
return {
19-
title: '激励视频广告'
19+
title: '激励视频广告',
20+
loading: false
2021
}
2122
},
2223
onReady() {
@@ -36,9 +37,11 @@
3637
createAd() {
3738
var rewardedVideoAd = this.rewardedVideoAd = uni.createRewardedVideoAd(this.adOption);
3839
rewardedVideoAd.onLoad(() => {
40+
this.loading = false;
3941
console.log('onLoad event')
4042
});
4143
rewardedVideoAd.onClose((res) => {
44+
this.loading = true;
4245
// 用户点击了【关闭广告】按钮
4346
if (res && res.isEnded) {
4447
// 正常播放结束
@@ -57,8 +60,10 @@
5760
}, 500)
5861
});
5962
rewardedVideoAd.onError((err) => {
63+
this.loading = false;
6064
console.log('onError event', err)
6165
});
66+
this.loading = true;
6267
},
6368
show() {
6469
const rewardedVideoAd = this.rewardedVideoAd;

0 commit comments

Comments
 (0)