更多话题
This commit is contained in:
		@@ -1,14 +1,13 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="Topic">
 | 
			
		||||
    <div class="Topic-item" v-for="(item, index) in 10" :key="index">
 | 
			
		||||
      <h2>#闲置物品交易</h2>
 | 
			
		||||
    <div class="Topic-item" v-for="(item, index) in list" :key="index" @click="toTopicDetail(item.id)">
 | 
			
		||||
      <h2>#{{item.title}}</h2>
 | 
			
		||||
      <span>去看看</span>
 | 
			
		||||
    </div>
 | 
			
		||||
    <AiLogin ref="login"/>
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
<script>
 | 
			
		||||
  import { mapActions, mapState } from 'vuex'
 | 
			
		||||
 | 
			
		||||
  export default {
 | 
			
		||||
    name: 'Topic',
 | 
			
		||||
@@ -16,18 +15,33 @@
 | 
			
		||||
 | 
			
		||||
    data () {
 | 
			
		||||
      return {
 | 
			
		||||
        current: 1,
 | 
			
		||||
        pages: 2,
 | 
			
		||||
        list: []
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    computed: {
 | 
			
		||||
      ...mapState(['user', 'token'])
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    onLoad() {
 | 
			
		||||
      this.getList()
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    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>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user