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

@@ -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>