1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-12-17 08:09:09 +09:00
MisskeyIO/src/web/app/mobile/views/components/user-timeline.vue

47 lines
1.1 KiB
Vue
Raw Normal View History

2018-02-16 20:53:15 +09:00
<template>
<div class="mk-user-timeline">
<mk-posts :posts="posts">
<div class="init" v-if="fetching">
%fa:spinner .pulse%%i18n:common.loading%
</div>
<div class="empty" v-if="!fetching && posts.length == 0">
%fa:R comments%
{{ withMedia ? '%i18n:mobile.tags.mk-user-timeline.no-posts-with-media%' : '%i18n:mobile.tags.mk-user-timeline.no-posts%' }}
</div>
<button v-if="canFetchMore" @click="more" :disabled="fetching" slot="tail">
<span v-if="!fetching">%i18n:mobile.tags.mk-user-timeline.load-more%</span>
<span v-if="fetching">%i18n:common.loading%<mk-ellipsis/></span>
</button>
</mk-posts>
</div>
</template>
<script lang="ts">
import Vue from 'vue';
export default Vue.extend({
props: ['user', 'withMedia'],
data() {
return {
fetching: true,
posts: []
};
},
mounted() {
2018-02-18 12:35:18 +09:00
(this as any).api('users/posts', {
2018-02-16 20:53:15 +09:00
user_id: this.user.id,
with_media: this.withMedia
}).then(posts => {
this.posts = posts;
2018-02-19 23:37:09 +09:00
this.fetching = false;
2018-02-16 20:53:15 +09:00
this.$emit('loaded');
});
}
});
</script>
<style lang="stylus" scoped>
.mk-user-timeline
max-width 600px
margin 0 auto
</style>