文件
OmniCard/mpuniapp/pages/component/ad/ad.uvue

57 行
1.4 KiB
Plaintext

<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 setup lang="uts">
const tips = ref(false)
const pushList = () => {
uni.navigateTo({
url: '/pages/component/ad/list-view-ad',
})
}
const pushVideoAd = () => {
uni.navigateTo({
url: '/pages/component/ad/video-ad',
})
}
const pushVideoAdL = () => {
uni.navigateTo({
url: '/pages/component/ad/landscape-video-ad',
})
}
const pushVideoAdP = () => {
uni.navigateTo({
url: '/pages/component/ad/portrait-video-ad',
})
}
const loadFun = () => {
uni.showToast({
position: "bottom",
title: "信息流广告加载成功"
})
}
const errorFun = () => {
tips.value = true;
}
</script>