wip: refactor(client): migrate paging components to composition api
This commit is contained in:
parent
2900f998b1
commit
bd1f741dad
|
@ -8,47 +8,32 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import { computed, defineComponent } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
import * as misskey from 'misskey-js';
|
||||||
import MkUserInfo from '@/components/user-info.vue';
|
import MkUserInfo from '@/components/user-info.vue';
|
||||||
import MkPagination from '@/components/ui/pagination.vue';
|
import MkPagination from '@/components/ui/pagination.vue';
|
||||||
|
|
||||||
export default defineComponent({
|
const props = defineProps<{
|
||||||
components: {
|
user: misskey.entities.User;
|
||||||
MkPagination,
|
type: 'following' | 'followers';
|
||||||
MkUserInfo,
|
}>();
|
||||||
},
|
|
||||||
|
|
||||||
props: {
|
const followingPagination = {
|
||||||
user: {
|
endpoint: 'users/following' as const,
|
||||||
type: Object,
|
limit: 20,
|
||||||
required: true
|
params: computed(() => ({
|
||||||
},
|
userId: props.user.id,
|
||||||
type: {
|
})),
|
||||||
type: String,
|
};
|
||||||
required: true
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
data() {
|
const followersPagination = {
|
||||||
return {
|
endpoint: 'users/followers' as const,
|
||||||
followingPagination: {
|
limit: 20,
|
||||||
endpoint: 'users/following' as const,
|
params: computed(() => ({
|
||||||
limit: 20,
|
userId: props.user.id,
|
||||||
params: computed(() => ({
|
})),
|
||||||
userId: this.user.id,
|
};
|
||||||
})),
|
|
||||||
},
|
|
||||||
followersPagination: {
|
|
||||||
endpoint: 'users/followers' as const,
|
|
||||||
limit: 20,
|
|
||||||
params: computed(() => ({
|
|
||||||
userId: this.user.id,
|
|
||||||
})),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -8,27 +8,16 @@
|
||||||
</MkContainer>
|
</MkContainer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import { defineComponent } from 'vue';
|
import { } from 'vue';
|
||||||
import * as os from '@/os';
|
import * as misskey from 'misskey-js';
|
||||||
import MkContainer from '@/components/ui/container.vue';
|
import MkContainer from '@/components/ui/container.vue';
|
||||||
import MkChart from '@/components/chart.vue';
|
import MkChart from '@/components/chart.vue';
|
||||||
|
|
||||||
export default defineComponent({
|
const props = withDefaults(defineProps<{
|
||||||
components: {
|
user: misskey.entities.User;
|
||||||
MkContainer,
|
limit?: number;
|
||||||
MkChart,
|
}>(), {
|
||||||
},
|
limit: 40,
|
||||||
props: {
|
|
||||||
user: {
|
|
||||||
type: Object,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
limit: {
|
|
||||||
type: Number,
|
|
||||||
required: false,
|
|
||||||
default: 40
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -6,36 +6,23 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import { computed, defineComponent } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
import * as misskey from 'misskey-js';
|
||||||
import MkPagePreview from '@/components/page-preview.vue';
|
import MkPagePreview from '@/components/page-preview.vue';
|
||||||
import MkPagination from '@/components/ui/pagination.vue';
|
import MkPagination from '@/components/ui/pagination.vue';
|
||||||
|
|
||||||
export default defineComponent({
|
const props = defineProps<{
|
||||||
components: {
|
user: misskey.entities.User;
|
||||||
MkPagination,
|
}>();
|
||||||
MkPagePreview,
|
|
||||||
},
|
|
||||||
|
|
||||||
props: {
|
const pagination = {
|
||||||
user: {
|
endpoint: 'users/pages' as const,
|
||||||
type: Object,
|
limit: 20,
|
||||||
required: true
|
params: computed(() => ({
|
||||||
},
|
userId: props.user.id,
|
||||||
},
|
})),
|
||||||
|
};
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
pagination: {
|
|
||||||
endpoint: 'users/pages' as const,
|
|
||||||
limit: 20,
|
|
||||||
params: computed(() => ({
|
|
||||||
userId: this.user.id,
|
|
||||||
})),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -13,38 +13,24 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import { computed, defineComponent } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
import * as misskey from 'misskey-js';
|
||||||
import MkPagination from '@/components/ui/pagination.vue';
|
import MkPagination from '@/components/ui/pagination.vue';
|
||||||
import MkNote from '@/components/note.vue';
|
import MkNote from '@/components/note.vue';
|
||||||
import MkReactionIcon from '@/components/reaction-icon.vue';
|
import MkReactionIcon from '@/components/reaction-icon.vue';
|
||||||
|
|
||||||
export default defineComponent({
|
const props = defineProps<{
|
||||||
components: {
|
user: misskey.entities.User;
|
||||||
MkPagination,
|
}>();
|
||||||
MkNote,
|
|
||||||
MkReactionIcon,
|
|
||||||
},
|
|
||||||
|
|
||||||
props: {
|
const pagination = {
|
||||||
user: {
|
endpoint: 'users/reactions' as const,
|
||||||
type: Object,
|
limit: 20,
|
||||||
required: true
|
params: computed(() => ({
|
||||||
},
|
userId: props.user.id,
|
||||||
},
|
})),
|
||||||
|
};
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
pagination: {
|
|
||||||
endpoint: 'users/reactions' as const,
|
|
||||||
limit: 20,
|
|
||||||
params: computed(() => ({
|
|
||||||
userId: this.user.id,
|
|
||||||
})),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
Loading…
Reference in New Issue