This commit is contained in:
yanran200730
2022-01-14 16:14:40 +08:00
parent c944d6dcec
commit dc5a400ec9
2 changed files with 16 additions and 5 deletions

View File

@@ -29,7 +29,8 @@ export default {
return { return {
title: '', title: '',
current: 1, current: 1,
list: [] list: [],
isMore: false
} }
}, },
computed: {...mapState(['user'])}, computed: {...mapState(['user'])},
@@ -57,13 +58,17 @@ export default {
} }
}).then(res => { }).then(res => {
if (res?.data) { if (res?.data) {
if (res.data.records.length < 10) {
this.isMore = true
}
res.data.records.forEach(e => { res.data.records.forEach(e => {
e.cellName = `${e.communityName + e.buildingNumber}` e.cellName = `${e.communityName + e.buildingNumber}`
}) })
if (this.current > 1 && this.current > res.data.pages) { if (this.current > 1 && this.current > res.data.pages) {
return return
} }
this.list = this.current > 1 ? [...this.datas, ...res.data.records] : res.data.records this.list = this.current > 1 ? [...this.list, ...res.data.records] : res.data.records
this.pages = res.data.pages this.pages = res.data.pages
} }
}) })
@@ -77,14 +82,20 @@ export default {
}, },
onReachBottom() { onReachBottom() {
this.current++; if (this.isMore) return
this.getList()
this.current++
this.$nextTick(() => {
this.getList()
})
}, },
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.list { .list {
padding-bottom: 20px;
.list-content { .list-content {
padding: 32px 32px 0; padding: 32px 32px 0;
background-color: #F5F5F5; background-color: #F5F5F5;

View File

@@ -138,7 +138,7 @@ uni-page-body {
} }
.map { .map {
height: 100%; height: 100vh;
.build-btn { .build-btn {
width: 80px; width: 80px;