mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-25 03:54:07 +02:00
refactor(frontend): improve pagination implementation
This commit is contained in:
@@ -11,7 +11,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<div v-else-if="tab === 'users'" class="_spacer" style="--MI_SPACER-w: 1200px;">
|
||||
<div class="_gaps_s">
|
||||
<div v-if="role">{{ role.description }}</div>
|
||||
<MkUserList v-if="visible" :pagination="users" :extractor="(item) => item.user"/>
|
||||
<MkUserList v-if="visible" :paginator="usersPaginator" :extractor="(item) => item.user"/>
|
||||
<MkResult v-else-if="!visible" type="empty" :text="i18n.ts.nothing"/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -23,13 +23,14 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, watch, ref } from 'vue';
|
||||
import { computed, watch, ref, markRaw } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { misskeyApi } from '@/utility/misskey-api.js';
|
||||
import MkUserList from '@/components/MkUserList.vue';
|
||||
import { definePage } from '@/page.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import MkStreamingNotesTimeline from '@/components/MkStreamingNotesTimeline.vue';
|
||||
import { Paginator } from '@/utility/paginator.js';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
roleId: string;
|
||||
@@ -60,12 +61,11 @@ watch(() => props.roleId, () => {
|
||||
});
|
||||
}, { immediate: true });
|
||||
|
||||
const users = computed(() => ({
|
||||
endpoint: 'roles/users' as const,
|
||||
const usersPaginator = markRaw(new Paginator('roles/users', {
|
||||
limit: 30,
|
||||
params: {
|
||||
computedParams: computed(() => ({
|
||||
roleId: props.roleId,
|
||||
},
|
||||
})),
|
||||
}));
|
||||
|
||||
const headerTabs = computed(() => [{
|
||||
|
||||
Reference in New Issue
Block a user