更多话题
This commit is contained in:
@@ -1,14 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="Topic">
|
<div class="Topic">
|
||||||
<div class="Topic-item" v-for="(item, index) in 10" :key="index">
|
<div class="Topic-item" v-for="(item, index) in list" :key="index" @click="toTopicDetail(item.id)">
|
||||||
<h2>#闲置物品交易</h2>
|
<h2>#{{item.title}}</h2>
|
||||||
<span>去看看</span>
|
<span>去看看</span>
|
||||||
</div>
|
</div>
|
||||||
<AiLogin ref="login"/>
|
<AiLogin ref="login"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { mapActions, mapState } from 'vuex'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Topic',
|
name: 'Topic',
|
||||||
@@ -16,18 +15,33 @@
|
|||||||
|
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
current: 1,
|
||||||
|
pages: 2,
|
||||||
|
list: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
|
||||||
...mapState(['user', 'token'])
|
|
||||||
},
|
|
||||||
|
|
||||||
onLoad() {
|
onLoad() {
|
||||||
|
this.getList()
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['autoLogin', 'authCheck'])
|
getList() {
|
||||||
|
if (this.current > this.pages) return
|
||||||
|
this.$instance.post(`/app/appneighborhoodassistancetheme/list¤t=${this.current}&size=20`).then(res => {
|
||||||
|
if (res.code === 0 && res.data) {
|
||||||
|
const list = this.current > 1 ? [...this.list, ...res.data.records] : res.data.records
|
||||||
|
this.pages = Math.ceil(res.data.total / 10)
|
||||||
|
this.list = list
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
toTopicDetail(id) {
|
||||||
|
uni.navigateTo({url: `./TopicDetail?id=${id}`})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onReachBottom() {
|
||||||
|
this.current ++
|
||||||
|
this.getList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user