This commit is contained in:
syuilo 2018-02-22 22:03:44 +09:00
parent 7816282318
commit bc632cefe5
11 changed files with 104 additions and 90 deletions

View file

@ -13,6 +13,7 @@ import userCard from './user-card.vue';
import postDetail from './post-detail.vue';
import followButton from './follow-button.vue';
import friendsMaker from './friends-maker.vue';
import notification from './notification.vue';
import notifications from './notifications.vue';
import notificationPreview from './notification-preview.vue';
@ -29,5 +30,6 @@ Vue.component('mk-user-card', userCard);
Vue.component('mk-post-detail', postDetail);
Vue.component('mk-follow-button', followButton);
Vue.component('mk-friends-maker', friendsMaker);
Vue.component('mk-notification', notification);
Vue.component('mk-notifications', notifications);
Vue.component('mk-notification-preview', notificationPreview);

View file

@ -106,6 +106,7 @@ import Vue from 'vue';
import getPostSummary from '../../../../../common/get-post-summary';
export default Vue.extend({
props: ['notification'],
data() {
return {
getPostSummary

View file

@ -10,7 +10,8 @@
</template>
</div>
<button class="more" v-if="moreNotifications" @click="fetchMoreNotifications" :disabled="fetchingMoreNotifications">
<template v-if="fetchingMoreNotifications">%fa:spinner .pulse .fw%</template>{ fetchingMoreNotifications ? '%i18n:common.loading%' : '%i18n:mobile.tags.mk-notifications.more%' }
<template v-if="fetchingMoreNotifications">%fa:spinner .pulse .fw%</template>
{{ fetchingMoreNotifications ? '%i18n:common.loading%' : '%i18n:mobile.tags.mk-notifications.more%' }}
</button>
<p class="empty" v-if="notifications.length == 0 && !fetching">%i18n:mobile.tags.mk-notifications.empty%</p>
<p class="fetching" v-if="fetching">%fa:spinner .pulse .fw%%i18n:common.loading%<mk-ellipsis/></p>

View file

@ -3,7 +3,7 @@
<slot name="head"></slot>
<slot></slot>
<template v-for="(post, i) in _posts">
<x-post :post="post" :key="post.id"/>
<x-post :post="post" :key="post.id" @update:post="onPostUpdated(i, $event)"/>
<p class="date" v-if="i != posts.length - 1 && post._date != _posts[i + 1]._date">
<span>%fa:angle-up%{{ post._datetext }}</span>
<span>%fa:angle-down%{{ _posts[i + 1]._datetext }}</span>
@ -39,6 +39,11 @@ export default Vue.extend({
return post;
});
}
},
methods: {
onPostUpdated(i, post) {
Vue.set((this as any).posts, i, post);
}
}
});
</script>

View file

@ -4,7 +4,7 @@
<main v-if="!fetching">
<a v-if="post.next" :href="post.next">%fa:angle-up%%i18n:mobile.tags.mk-post-page.next%</a>
<div>
<mk-post-detail :post="parent.post"/>
<mk-post-detail :post="post"/>
</div>
<a v-if="post.prev" :href="post.prev">%fa:angle-down%%i18n:mobile.tags.mk-post-page.prev%</a>
</main>

View file

@ -58,7 +58,7 @@
<script lang="ts">
import Vue from 'vue';
import age from 's-age';
import * as age from 's-age';
import Progress from '../../../common/scripts/loading';
import XHome from './user/home.vue';