This commit is contained in:
こぴなたみぽ 2018-02-16 13:11:54 +09:00
parent 0bf007df9e
commit ec63c3463a
2 changed files with 8 additions and 29 deletions

View File

@ -1,27 +0,0 @@
<mk-user-page>
<mk-ui ref="ui">
<mk-user ref="user" user={ parent.user } page={ parent.opts.page }/>
</mk-ui>
<style lang="stylus" scoped>
:scope
display block
</style>
<script lang="typescript">
import ui from '../../scripts/ui-event';
import Progress from '../../../common/scripts/loading';
this.user = this.opts.user;
this.on('mount', () => {
document.documentElement.style.background = '#313a42';
Progress.start();
this.$refs.ui.refs.user.on('loaded', user => {
Progress.done();
document.title = user.name + ' | Misskey';
// TODO: ユーザー名をエスケープ
ui.trigger('title', '%fa:user%' + user.name);
});
});
</script>
</mk-user-page>

View File

@ -1,6 +1,6 @@
<template> <template>
<mk-ui :func="fn" func-icon="%fa:pencil-alt%"> <mk-ui :func="fn" func-icon="%fa:pencil-alt%">
<span slot="header">%fa:user% {{user.name}}</span> <span slot="header" v-if="!fetching">%fa:user% {{user.name}}</span>
<div v-if="!fetching" :class="$style.user"> <div v-if="!fetching" :class="$style.user">
<header> <header>
<div class="banner" :style="user.banner_url ? `background-image: url(${user.banner_url}?thumbnail&size=1024)` : ''"></div> <div class="banner" :style="user.banner_url ? `background-image: url(${user.banner_url}?thumbnail&size=1024)` : ''"></div>
@ -58,6 +58,7 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
const age = require('s-age'); const age = require('s-age');
import Progress from '../../../common/scripts/loading';
export default Vue.extend({ export default Vue.extend({
props: { props: {
@ -81,12 +82,17 @@ export default Vue.extend({
} }
}, },
mounted() { mounted() {
document.documentElement.style.background = '#313a42';
Progress.start();
this.$root.$data.os.api('users/show', { this.$root.$data.os.api('users/show', {
username: this.username username: this.username
}).then(user => { }).then(user => {
this.fetching = false; this.fetching = false;
this.user = user; this.user = user;
this.$emit('loaded', user);
Progress.done();
document.title = user.name + ' | Misskey';
}); });
} }
}); });