wip
This commit is contained in:
parent
4fd3192791
commit
1025077df2
6 changed files with 60 additions and 39 deletions
|
@ -25,6 +25,7 @@ import MkSelectDrive from './views/pages/selectdrive.vue';
|
||||||
import MkDrive from './views/pages/drive.vue';
|
import MkDrive from './views/pages/drive.vue';
|
||||||
import MkHomeCustomize from './views/pages/home-customize.vue';
|
import MkHomeCustomize from './views/pages/home-customize.vue';
|
||||||
import MkMessagingRoom from './views/pages/messaging-room.vue';
|
import MkMessagingRoom from './views/pages/messaging-room.vue';
|
||||||
|
import MkPost from './views/pages/post.vue';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* init
|
* init
|
||||||
|
@ -75,7 +76,8 @@ init(async (launch) => {
|
||||||
{ path: '/i/drive', component: MkDrive },
|
{ path: '/i/drive', component: MkDrive },
|
||||||
{ path: '/i/drive/folder/:folder', component: MkDrive },
|
{ path: '/i/drive/folder/:folder', component: MkDrive },
|
||||||
{ path: '/selectdrive', component: MkSelectDrive },
|
{ path: '/selectdrive', component: MkSelectDrive },
|
||||||
{ path: '/:user', component: MkUser }
|
{ path: '/:user', component: MkUser },
|
||||||
|
{ path: '/:user/:post', component: MkPost }
|
||||||
]);
|
]);
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</router-link>
|
</router-link>
|
||||||
</header>
|
</header>
|
||||||
<div class="body">
|
<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"/>
|
<mk-url-preview v-for="url in urls" :url="url" :key="url"/>
|
||||||
<div class="media" v-if="p.media">
|
<div class="media" v-if="p.media">
|
||||||
<mk-images :images="p.media"/>
|
<mk-images :images="p.media"/>
|
||||||
|
@ -311,15 +311,6 @@ export default Vue.extend({
|
||||||
> .body
|
> .body
|
||||||
padding 8px 0
|
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
|
> .mk-url-preview
|
||||||
margin-top 8px
|
margin-top 8px
|
||||||
|
|
||||||
|
@ -351,3 +342,14 @@ export default Vue.extend({
|
||||||
border-top 1px solid #eef0f2
|
border-top 1px solid #eef0f2
|
||||||
|
|
||||||
</style>
|
</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>
|
||||||
|
|
|
@ -13,20 +13,25 @@ import Vue from 'vue';
|
||||||
import Progress from '../../../common/scripts/loading';
|
import Progress from '../../../common/scripts/loading';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: ['postId'],
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
fetching: true,
|
fetching: true,
|
||||||
post: null
|
post: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
watch: {
|
||||||
|
$route: 'fetch'
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.fetch();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
fetch() {
|
||||||
Progress.start();
|
Progress.start();
|
||||||
|
this.fetching = true;
|
||||||
// TODO: extract the fetch step for vue-router's caching
|
|
||||||
|
|
||||||
(this as any).api('posts/show', {
|
(this as any).api('posts/show', {
|
||||||
post_id: this.postId
|
post_id: this.$route.params.post
|
||||||
}).then(post => {
|
}).then(post => {
|
||||||
this.post = post;
|
this.post = post;
|
||||||
this.fetching = false;
|
this.fetching = false;
|
||||||
|
@ -34,6 +39,7 @@ export default Vue.extend({
|
||||||
Progress.done();
|
Progress.done();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ import MkDrive from './views/pages/drive.vue';
|
||||||
import MkNotifications from './views/pages/notifications.vue';
|
import MkNotifications from './views/pages/notifications.vue';
|
||||||
import MkMessaging from './views/pages/messaging.vue';
|
import MkMessaging from './views/pages/messaging.vue';
|
||||||
import MkMessagingRoom from './views/pages/messaging-room.vue';
|
import MkMessagingRoom from './views/pages/messaging-room.vue';
|
||||||
|
import MkPost from './views/pages/post.vue';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* init
|
* init
|
||||||
|
@ -57,6 +58,7 @@ init((launch) => {
|
||||||
{ path: '/i/drive/folder/:folder', component: MkDrive },
|
{ path: '/i/drive/folder/:folder', component: MkDrive },
|
||||||
{ path: '/i/drive/file/:file', component: MkDrive },
|
{ path: '/i/drive/file/:file', component: MkDrive },
|
||||||
{ path: '/selectdrive', component: MkSelectDrive },
|
{ path: '/selectdrive', component: MkSelectDrive },
|
||||||
{ path: '/:user', component: MkUser }
|
{ path: '/:user', component: MkUser },
|
||||||
|
{ path: '/:user/:post', component: MkPost }
|
||||||
]);
|
]);
|
||||||
}, true);
|
}, true);
|
||||||
|
|
|
@ -16,21 +16,29 @@ import Vue from 'vue';
|
||||||
import Progress from '../../../common/scripts/loading';
|
import Progress from '../../../common/scripts/loading';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: ['postId'],
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
fetching: true,
|
fetching: true,
|
||||||
post: null
|
post: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
$route: 'fetch'
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.fetch();
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
document.title = 'Misskey';
|
document.title = 'Misskey';
|
||||||
document.documentElement.style.background = '#313a42';
|
document.documentElement.style.background = '#313a42';
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
fetch() {
|
||||||
Progress.start();
|
Progress.start();
|
||||||
|
this.fetching = true;
|
||||||
|
|
||||||
(this as any).api('posts/show', {
|
(this as any).api('posts/show', {
|
||||||
post_id: this.postId
|
post_id: this.$route.params.post
|
||||||
}).then(post => {
|
}).then(post => {
|
||||||
this.post = post;
|
this.post = post;
|
||||||
this.fetching = false;
|
this.fetching = false;
|
||||||
|
@ -38,6 +46,7 @@ export default Vue.extend({
|
||||||
Progress.done();
|
Progress.done();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -82,12 +82,12 @@ export default Vue.extend({
|
||||||
return age(this.user.profile.birthday);
|
return age(this.user.profile.birthday);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
|
||||||
this.fetch();
|
|
||||||
},
|
|
||||||
watch: {
|
watch: {
|
||||||
$route: 'fetch'
|
$route: 'fetch'
|
||||||
},
|
},
|
||||||
|
created() {
|
||||||
|
this.fetch();
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
document.documentElement.style.background = '#313a42';
|
document.documentElement.style.background = '#313a42';
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue