This commit is contained in:
syuilo 2018-02-13 08:31:03 +09:00
parent 143088b9ef
commit 21c4f863ef

View file

@ -1,11 +1,11 @@
<template> <template>
<div class="mk-timeline" ref="root"> <div class="mk-timeline">
<template v-for="(post, i) in _posts"> <template v-for="(post, i) in _posts">
<mk-timeline-post :post.sync="post" :key="post.id"/> <mk-timeline-post :post.sync="post" :key="post.id"/>
<p class="date" :key="post.id + '-time'" 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></p> <p class="date" :key="post.id + '-time'" 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></p>
</template> </template>
<footer data-yield="footer"> <footer>
<yield from="footer"/> <slot name="footer"></slot>
</footer> </footer>
</div> </div>
</template> </template>
@ -21,7 +21,7 @@ export default Vue.extend({
} }
}, },
computed: { computed: {
_posts(): any { _posts(): any[] {
return this.posts.map(post => { return this.posts.map(post => {
const date = new Date(post.created_at).getDate(); const date = new Date(post.created_at).getDate();
const month = new Date(post.created_at).getMonth() + 1; const month = new Date(post.created_at).getMonth() + 1;
@ -36,7 +36,7 @@ export default Vue.extend({
}, },
methods: { methods: {
focus() { focus() {
(this.$refs.root as any).children[0].focus(); (this.$el as any).children[0].focus();
} }
} }
}); });