提交 1204641f 编写于 作者: 张磊

调整信息流广告展示的位置。

上级 74597725
<template> <template>
<list-view @scrolltolower="onScrollTolower" style="flex:1" show-scrollbar=false> <list-view @scrolltolower="onScrollTolower" style="flex:1" show-scrollbar=false>
<list-item v-for="index in listcount" :type="(index != 0 && index%10 == 0) ? 0:1"> <list-item v-for="index in listcount" :type="(index != 0 && index%10 == 6) ? 0:1">
<ad v-if="index != 0 && index%10 == 0" adpid="1111111111" @load="onAdLoad" @error="onAdError" @close="onAdClose"></ad> <ad v-if="index != 0 && index%10 == 6" adpid="1111111111" @load="onAdLoad" @error="onAdError" @close="onAdClose"></ad>
<text v-if="index == 0 || index%10 != 0" style="width: 100%; height: 200px;background-color: aquamarine;margin-top: 10px;">这是一条占位的信息{{index}}</text> <text v-if="index == 0 || index%10 != 6" style="width: 100%; height: 200px;background-color: aquamarine;margin-top: 10px;">这是一条占位的信息{{index}}</text>
</list-item> </list-item>
</list-view> </list-view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
listcount: 10 listcount: 10
} }
}, },
methods: { methods: {
onScrollTolower(_ : ScrollToLowerEvent) { onScrollTolower(_ : ScrollToLowerEvent) {
console.log("打印日志") setTimeout(() => {
this.listcount = this.listcount + 10 this.listcount = this.listcount + 10
}, }, 300)
onAdLoad() { },
console.log("广告加载成功") onAdLoad() {
uni.showToast({ console.log("广告加载成功")
position: "center", uni.showToast({
title: "广告加载成功" position: "center",
}) title: "广告加载成功"
}, })
onAdError(e : UniAdErrorEvent) { },
console.log("广告加载失败" + (e.detail)) onAdError(e : UniAdErrorEvent) {
}, console.log("广告加载失败" + (e.detail))
onAdClose() { },
console.log("广告关闭了") onAdClose() {
} console.log("广告关闭了")
} }
} }
}
</script> </script>
<style> <style>
</style> </style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册