Commit a326fa69 authored by Damon's avatar Damon

refactor: 搜索

parent afbdea00
......@@ -64,7 +64,8 @@
"name": "searchDetail",
"style": {
"navigationBarTitleText": "搜索结果",
"navigationStyle": "custom"
"navigationStyle": "custom",
"disableScroll": true
}
}
]
......
......@@ -26,16 +26,18 @@
>共找到含有<text>“{{ keyword }}”</text>相关试题<text>{{ total }}</text
>道</view
>
<view class="result">
<my-section
v-for="(item, index) in section"
:key="index"
:begin="item.begin"
:arrId.sync="arrId"
:end="item.end"
:keyword="keyword"
></my-section>
<u-loadmore :status="loadStatus" :margin-bottom="40" />
<view class="u-flex result">
<scroll-view :scroll-top="scrollTop" scroll-y class="scroll-Y" @scrolltolower="scrolltolower">
<my-section
v-for="(item, index) in section"
:key="index"
:begin="item.begin"
:arrId.sync="arrId"
:end="item.end"
:keyword="keyword"
></my-section>
</scroll-view>
<u-loadmore class="more" :status="loadStatus" :margin-bottom="40" />
</view>
</view>
......@@ -84,15 +86,7 @@ export default {
return process.uniEnv.qn_base_url + 'no-search.png'
}
},
onReachBottom() {
//上拉触底函数
if (!this.isLoadMore) {
//此处判断,上锁,防止重复请求
this.isLoadMore = true
this.currentPage += 1
this.init()
}
},
methods: {
init() {
const data = {
......@@ -142,7 +136,7 @@ export default {
end: this.lists.length,
})
this.arrId = this.lists[0].id
if (records.length < this.pageSize) {
if (res.pages === this.currentPage) {
//判断接口返回数据量小于请求数据量,则表示此为最后一页
this.isLoadMore = true
this.loadStatus = 'nomore'
......@@ -168,8 +162,17 @@ export default {
this.arrId = ''
this.init()
}
},
scrolltolower() {
//上拉触底函数
if (!this.isLoadMore) {
//此处判断,上锁,防止重复请求
this.isLoadMore = true
this.currentPage += 1
this.init()
}
}
},
}
}
</script>
......@@ -202,6 +205,13 @@ export default {
.result {
margin-top: 30rpx;
width: 100%;
flex-flow: column;
.scroll-Y {
height: calc(100vh - 230px);
}
.more {
margin-top: 20rpx;
}
}
.default {
flex-flow: column;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment