forked from mirrors/misskey
wip: refactor(client): migrate paging components to composition api
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<MkPagination v-slot="{items}" ref="list" :pagination="pagination" class="mk-following-or-followers">
|
||||
<MkPagination v-slot="{items}" ref="list" :pagination="type === 'following' ? followingPagination : followersPagination" class="mk-following-or-followers">
|
||||
<div class="users _isolated">
|
||||
<MkUserInfo v-for="user in items.map(x => type === 'following' ? x.followee : x.follower)" :key="user.id" class="user" :user="user"/>
|
||||
</div>
|
||||
@@ -9,7 +9,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { computed, defineComponent } from 'vue';
|
||||
import MkUserInfo from '@/components/user-info.vue';
|
||||
import MkPagination from '@/components/ui/pagination.vue';
|
||||
|
||||
@@ -32,25 +32,22 @@ export default defineComponent({
|
||||
|
||||
data() {
|
||||
return {
|
||||
pagination: {
|
||||
endpoint: () => this.type === 'following' ? 'users/following' : 'users/followers',
|
||||
followingPagination: {
|
||||
endpoint: 'users/following',
|
||||
limit: 20,
|
||||
params: {
|
||||
params: computed(() => ({
|
||||
userId: this.user.id,
|
||||
}
|
||||
})),
|
||||
},
|
||||
followersPagination: {
|
||||
endpoint: 'users/followers',
|
||||
limit: 20,
|
||||
params: computed(() => ({
|
||||
userId: this.user.id,
|
||||
})),
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
watch: {
|
||||
type() {
|
||||
this.$refs.list.reload();
|
||||
},
|
||||
|
||||
user() {
|
||||
this.$refs.list.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user