list-view-ad.uvue 1.1 KB
Newer Older
DCloud_iOS_WZT's avatar
DCloud_iOS_WZT 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
<template>

	<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">
			<ad v-if="index != 0 && index%10 == 0" 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>
		</list-item>
	</list-view>
</template>

<script>
	export default {
		data() {
			return {
				listcount: 10
			}
		},
		methods: {
			onScrollTolower(_ : ScrollToLowerEvent) {
				console.log("打印日志")
				this.listcount = this.listcount + 10
			},
			onAdLoad() {
				console.log("广告加载成功")
				uni.showToast({
					position: "center",
					title: "广告加载成功"
				})
			},
			onAdError(e : UniAdErrorEvent) {
				console.log("广告加载失败" + (e.detail))
			},
			onAdClose() {
				console.log("广告关闭了")
			}
		}
	}
</script>

<style>

</style>