[更新发现]
This commit is contained in:
@@ -11,8 +11,12 @@
|
||||
:lists="menuArr"
|
||||
:btnStyle="{'margin-top': '30rpx'}"
|
||||
:isNumber="true"
|
||||
@onMenu="$Router.push({ name: 'rankingDetails', params: {id: $event.id, title: $event.name }})"
|
||||
isType="rank"
|
||||
@onMenu="$Router.push({ name: 'rankingDetails', params: {id: $event.food_id, title: $event.name }})"
|
||||
/>
|
||||
<block v-if="page.total_page > 1">
|
||||
<u-loadmore :status="status" />
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -23,7 +27,9 @@
|
||||
data() {
|
||||
return {
|
||||
name : this.$Route.query.name,
|
||||
menuArr : []
|
||||
menuArr : [],
|
||||
status : 'loadmore',
|
||||
page : ''
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@@ -31,11 +37,30 @@
|
||||
},
|
||||
methods: {
|
||||
// 分类-食物
|
||||
getRank(){
|
||||
foods({category_id: this.$Route.query.id}).then(res => {
|
||||
this.menuArr = res.data
|
||||
getRank(pages){
|
||||
foods({
|
||||
category_id: this.$Route.query.id,
|
||||
page: pages
|
||||
}).then(res => {
|
||||
if(res.page.current == 1){
|
||||
this.menuArr = []
|
||||
}
|
||||
this.menuArr = this.menuArr.concat(res.data)
|
||||
this.status = this.page.has_more ? 'loadmore': 'nomore'
|
||||
this.page = res.page
|
||||
})
|
||||
}
|
||||
},
|
||||
// 下拉加载
|
||||
onReachBottom() {
|
||||
if(this.page.has_more){
|
||||
this.status = 'loading'
|
||||
let pages = this.page.current + 1
|
||||
// 获取列表
|
||||
this.getRank(pages)
|
||||
return
|
||||
}
|
||||
this.status = 'nomore'
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user