This commit is contained in:
syuilo 2018-02-22 21:23:10 +09:00
parent 4fd3192791
commit 1025077df2
6 changed files with 60 additions and 39 deletions

View file

@ -38,7 +38,7 @@
</router-link>
</header>
<div class="body">
<mk-post-html v-if="p.ast" :ast="p.ast" :i="os.i"/>
<mk-post-html :class="$style.text" v-if="p.ast" :ast="p.ast" :i="os.i"/>
<mk-url-preview v-for="url in urls" :url="url" :key="url"/>
<div class="media" v-if="p.media">
<mk-images :images="p.media"/>
@ -311,17 +311,8 @@ export default Vue.extend({
> .body
padding 8px 0
> .text
cursor default
display block
margin 0
padding 0
overflow-wrap break-word
font-size 1.5em
color #717171
> .mk-url-preview
margin-top 8px
> .mk-url-preview
margin-top 8px
> footer
font-size 1.2em
@ -351,3 +342,14 @@ export default Vue.extend({
border-top 1px solid #eef0f2
</style>
<style lang="stylus" module>
.text
cursor default
display block
margin 0
padding 0
overflow-wrap break-word
font-size 1.5em
color #717171
</style>

View file

@ -13,26 +13,32 @@ import Vue from 'vue';
import Progress from '../../../common/scripts/loading';
export default Vue.extend({
props: ['postId'],
data() {
return {
fetching: true,
post: null
};
},
mounted() {
Progress.start();
watch: {
$route: 'fetch'
},
created() {
this.fetch();
},
methods: {
fetch() {
Progress.start();
this.fetching = true;
// TODO: extract the fetch step for vue-router's caching
(this as any).api('posts/show', {
post_id: this.$route.params.post
}).then(post => {
this.post = post;
this.fetching = false;
(this as any).api('posts/show', {
post_id: this.postId
}).then(post => {
this.post = post;
this.fetching = false;
Progress.done();
});
Progress.done();
});
}
}
});
</script>