2020-01-30 04:37:25 +09:00
|
|
|
<template>
|
2020-11-25 21:31:34 +09:00
|
|
|
<div>
|
2022-01-10 03:30:35 +09:00
|
|
|
<MkPagination v-slot="{items}" ref="list" :pagination="type === 'following' ? followingPagination : followersPagination" class="mk-following-or-followers">
|
2021-04-10 18:17:42 +09:00
|
|
|
<div class="users _isolated">
|
2021-11-19 19:36:12 +09:00
|
|
|
<MkUserInfo v-for="user in items.map(x => type === 'following' ? x.followee : x.follower)" :key="user.id" class="user" :user="user"/>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
</MkPagination>
|
|
|
|
</div>
|
2020-01-30 04:37:25 +09:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2022-01-10 03:30:35 +09:00
|
|
|
import { computed, defineComponent } from 'vue';
|
2021-11-12 02:02:25 +09:00
|
|
|
import MkUserInfo from '@/components/user-info.vue';
|
|
|
|
import MkPagination from '@/components/ui/pagination.vue';
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
export default defineComponent({
|
2020-01-30 04:37:25 +09:00
|
|
|
components: {
|
|
|
|
MkPagination,
|
2020-10-17 20:12:00 +09:00
|
|
|
MkUserInfo,
|
2020-01-30 04:37:25 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
props: {
|
2020-10-25 01:21:41 +09:00
|
|
|
user: {
|
|
|
|
type: Object,
|
|
|
|
required: true
|
|
|
|
},
|
2020-01-30 04:37:25 +09:00
|
|
|
type: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
2020-10-25 01:21:41 +09:00
|
|
|
},
|
2020-01-30 04:37:25 +09:00
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
2022-01-10 03:30:35 +09:00
|
|
|
followingPagination: {
|
2022-01-13 02:26:10 +09:00
|
|
|
endpoint: 'users/following' as const,
|
2020-01-30 04:37:25 +09:00
|
|
|
limit: 20,
|
2022-01-10 03:30:35 +09:00
|
|
|
params: computed(() => ({
|
2020-10-25 01:21:41 +09:00
|
|
|
userId: this.user.id,
|
2022-01-10 03:30:35 +09:00
|
|
|
})),
|
|
|
|
},
|
|
|
|
followersPagination: {
|
2022-01-13 02:26:10 +09:00
|
|
|
endpoint: 'users/followers' as const,
|
2022-01-10 03:30:35 +09:00
|
|
|
limit: 20,
|
|
|
|
params: computed(() => ({
|
|
|
|
userId: this.user.id,
|
|
|
|
})),
|
2020-01-30 04:37:25 +09:00
|
|
|
},
|
|
|
|
};
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.mk-following-or-followers {
|
2020-10-17 20:12:00 +09:00
|
|
|
> .users {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
|
|
|
|
grid-gap: var(--margin);
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|