提交 19d805cc 编写于 作者: DCloud_iOS_WZT's avatar DCloud_iOS_WZT

新增 信息流-list测试例

上级 70df8b55
...@@ -507,7 +507,7 @@ ...@@ -507,7 +507,7 @@
} }
}, },
// #endif // #endif
// #ifdef APP-ANDROID // #ifdef APP
{ {
"path": "pages/component/ad/ad", "path": "pages/component/ad/ad",
"group": "0,8", "group": "0,8",
...@@ -516,6 +516,13 @@ ...@@ -516,6 +516,13 @@
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
}, },
{
"path": "pages/component/ad/list-view-ad",
"style": {
"navigationBarTitleText": "ad | 信息流广告",
"enablePullDownRefresh": false
}
},
// #endif // #endif
{ {
"path": "pages/tabBar/API", "path": "pages/tabBar/API",
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
<view> <view>
<page-head title="信息流广告"></page-head> <page-head title="信息流广告"></page-head>
<ad adpid="1111111111" style="width: 100%;" @load="loadFun" @error="errorFun"></ad> <ad adpid="1111111111" style="width: 100%;" @load="loadFun" @error="errorFun"></ad>
<view v-if="tips" class="uni-center">信息流广告加载失败,请退出当前页面重试。</view> <view v-if="tips" class="uni-center">信息流广告加载失败,请退出当前页面重试。</view>
<button @click="pushList">列表-信息流</button>
</view> </view>
</template> </template>
...@@ -13,7 +14,12 @@ ...@@ -13,7 +14,12 @@
tips: false tips: false
} }
}, },
methods: { methods: {
pushList(){
uni.navigateTo({
url: '/pages/component/ad/list-view-ad',
})
},
loadFun() { loadFun() {
uni.showToast({ uni.showToast({
position: "bottom", position: "bottom",
......
<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>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册