<template>
<view>
<page-head title="信息流广告"></page-head>
<!-- #ifndef MP -->
<ad adpid="1111111111" style="width: 100%;" @load="loadFun" @error="errorFun"></ad>
<!-- #endif -->
<!-- #ifdef MP -->
<view class="uni-center">微信小程序平台暂不支持测试广告位,需要开通uni-ad后可测试</view>
<!-- #endif -->
<view v-if="tips" class="uni-center">信息流广告加载失败,请退出当前页面重试。</view>
<button @click="pushList">列表-信息流</button>
<button @click="pushVideoAd">视频贴片-非全屏</button>
<button @click="pushVideoAdL">视频贴片-横向全屏</button>
<button @click="pushVideoAdP">视频贴片-竖向全屏</button>
</view>
</template>
<script>
export default {
data() {
return {
tips: false
}
},
methods: {
pushList() {
uni.navigateTo({
url: '/pages/component/ad/list-view-ad',
})
},
pushVideoAd() {
uni.navigateTo({
url: '/pages/component/ad/video-ad',
})
},
pushVideoAdL() {
uni.navigateTo({
url: '/pages/component/ad/landscape-video-ad',
})
},
pushVideoAdP() {
uni.navigateTo({
url: '/pages/component/ad/portrait-video-ad',
})
},
loadFun() {
uni.showToast({
position: "bottom",
title: "信息流广告加载成功"
})
},
errorFun() {
this.tips = true;
}
}
}
</script>