1
0

wip: refactor(client): migrate paging components to composition api

This commit is contained in:
syuilo
2022-01-13 02:46:14 +09:00
parent 2900f998b1
commit bd1f741dad
4 changed files with 55 additions and 108 deletions
+21 -36
View File
@@ -8,47 +8,32 @@
</div>
</template>
<script lang="ts">
import { computed, defineComponent } from 'vue';
<script lang="ts" setup>
import { computed } from 'vue';
import * as misskey from 'misskey-js';
import MkUserInfo from '@/components/user-info.vue';
import MkPagination from '@/components/ui/pagination.vue';
export default defineComponent({
components: {
MkPagination,
MkUserInfo,
},
const props = defineProps<{
user: misskey.entities.User;
type: 'following' | 'followers';
}>();
props: {
user: {
type: Object,
required: true
},
type: {
type: String,
required: true
},
},
const followingPagination = {
endpoint: 'users/following' as const,
limit: 20,
params: computed(() => ({
userId: props.user.id,
})),
};
data() {
return {
followingPagination: {
endpoint: 'users/following' as const,
limit: 20,
params: computed(() => ({
userId: this.user.id,
})),
},
followersPagination: {
endpoint: 'users/followers' as const,
limit: 20,
params: computed(() => ({
userId: this.user.id,
})),
},
};
},
});
const followersPagination = {
endpoint: 'users/followers' as const,
limit: 20,
params: computed(() => ({
userId: props.user.id,
})),
};
</script>
<style lang="scss" scoped>