diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2022-01-13 02:46:14 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2022-01-13 02:46:14 +0900 |
| commit | bd1f741dad0c33ed945d05ed413938fe7ea42ee5 (patch) | |
| tree | ee52a94e6bcd559d6e5545b5cd67562576eefcfd /packages/client/src | |
| parent | wip: refactor(client): migrate paging components to composition api (diff) | |
| download | misskey-bd1f741dad0c33ed945d05ed413938fe7ea42ee5.tar.gz misskey-bd1f741dad0c33ed945d05ed413938fe7ea42ee5.tar.bz2 misskey-bd1f741dad0c33ed945d05ed413938fe7ea42ee5.zip | |
wip: refactor(client): migrate paging components to composition api
Diffstat (limited to 'packages/client/src')
| -rw-r--r-- | packages/client/src/pages/user/follow-list.vue | 57 | ||||
| -rw-r--r-- | packages/client/src/pages/user/index.activity.vue | 27 | ||||
| -rw-r--r-- | packages/client/src/pages/user/pages.vue | 39 | ||||
| -rw-r--r-- | packages/client/src/pages/user/reactions.vue | 40 |
4 files changed, 55 insertions, 108 deletions
diff --git a/packages/client/src/pages/user/follow-list.vue b/packages/client/src/pages/user/follow-list.vue index b34757c166..98a1fc0f86 100644 --- a/packages/client/src/pages/user/follow-list.vue +++ b/packages/client/src/pages/user/follow-list.vue @@ -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> diff --git a/packages/client/src/pages/user/index.activity.vue b/packages/client/src/pages/user/index.activity.vue index e51d6c6090..43a4f476f1 100644 --- a/packages/client/src/pages/user/index.activity.vue +++ b/packages/client/src/pages/user/index.activity.vue @@ -8,27 +8,16 @@ </MkContainer> </template> -<script lang="ts"> -import { defineComponent } from 'vue'; -import * as os from '@/os'; +<script lang="ts" setup> +import { } from 'vue'; +import * as misskey from 'misskey-js'; import MkContainer from '@/components/ui/container.vue'; import MkChart from '@/components/chart.vue'; -export default defineComponent({ - components: { - MkContainer, - MkChart, - }, - props: { - user: { - type: Object, - required: true - }, - limit: { - type: Number, - required: false, - default: 40 - } - }, +const props = withDefaults(defineProps<{ + user: misskey.entities.User; + limit?: number; +}>(), { + limit: 40, }); </script> diff --git a/packages/client/src/pages/user/pages.vue b/packages/client/src/pages/user/pages.vue index 6ce84da0a2..ad101158e0 100644 --- a/packages/client/src/pages/user/pages.vue +++ b/packages/client/src/pages/user/pages.vue @@ -6,36 +6,23 @@ </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 MkPagePreview from '@/components/page-preview.vue'; import MkPagination from '@/components/ui/pagination.vue'; -export default defineComponent({ - components: { - MkPagination, - MkPagePreview, - }, +const props = defineProps<{ + user: misskey.entities.User; +}>(); - props: { - user: { - type: Object, - required: true - }, - }, - - data() { - return { - pagination: { - endpoint: 'users/pages' as const, - limit: 20, - params: computed(() => ({ - userId: this.user.id, - })), - }, - }; - }, -}); +const pagination = { + endpoint: 'users/pages' as const, + limit: 20, + params: computed(() => ({ + userId: props.user.id, + })), +}; </script> <style lang="scss" scoped> diff --git a/packages/client/src/pages/user/reactions.vue b/packages/client/src/pages/user/reactions.vue index 5cb035bace..0381542b4d 100644 --- a/packages/client/src/pages/user/reactions.vue +++ b/packages/client/src/pages/user/reactions.vue @@ -13,38 +13,24 @@ </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 MkPagination from '@/components/ui/pagination.vue'; import MkNote from '@/components/note.vue'; import MkReactionIcon from '@/components/reaction-icon.vue'; -export default defineComponent({ - components: { - MkPagination, - MkNote, - MkReactionIcon, - }, +const props = defineProps<{ + user: misskey.entities.User; +}>(); - props: { - user: { - type: Object, - required: true - }, - }, - - data() { - return { - pagination: { - endpoint: 'users/reactions' as const, - limit: 20, - params: computed(() => ({ - userId: this.user.id, - })), - }, - }; - }, -}); +const pagination = { + endpoint: 'users/reactions' as const, + limit: 20, + params: computed(() => ({ + userId: props.user.id, + })), +}; </script> <style lang="scss" scoped> |