adpid="adId" ad-intervals="60" @load="onload" @close="onclose" @error="onerror">
</ad>
</view>
<button @click="changeShow">显示广告111</button>
</view>
const showAd = ref(false);
function onload(e) {
uni.showToast({
title: '广告onload:' + JSON.stringify(e),
icon: 'none',
duration: 3000
})
};
function onclose(e) {
uni.showToast({
title: '广告onclose:' + JSON.stringify(e),
icon: 'none',
duration: 3000
})
};
function onerror(e) {
console.log('onerror=============', e);
uni.showToast({
title: '广告onerror:' + JSON.stringify(e),
icon: 'none',
duration: 3000
})
};
function changeShow() {
showAd.value = !showAd.value;
}
<style>
.test-box {
padding-top: 100px;
}
</style>
onload截图