author-follow.vue 1.17 KB
<template>
  <Layout class="author-follow-page">
    <LayoutHeader slot='header' theme="white" class="author-page-header">{{isMine ? '我的' : 'TA'}}关注</LayoutHeader>
    <UserList :on-fetch="onFetch"></UserList>
  </Layout>
</template>


<script>
import {assign, get} from 'lodash';
import {Scroll, Loading} from 'cube-ui';
import UserList from './components/user-list';
import {createNamespacedHelpers} from 'vuex';
const {mapActions} = createNamespacedHelpers('user');

export default {
  name: 'authorFollow',
  data() {
    return {
      isMine: false
    };
  },
  created() {
    this.isMine = !this.$route.params.id;
    this._baseParams = {
      authorType: this.$route.params.type || 1,
      limit: 20,
    };

    if (!this.isMine) {
      this._baseParams.authorUid = this.$route.params.id;
    }
  },
  methods: {
    ...mapActions(['authorAttentionList', 'authorMineAttentionList']),
    onFetch({page, lastedTime}) {
      let params = Object.assign({page, lastedTime}, this._baseParams);

      return this.isMine ? this.authorMineAttentionList(params) : this.authorAttentionList(params);
    }
  },
  components: {
    UserList
  }
}
</script>

<style lang="scss">

</style>