Stackedit/src/components/UserName.vue

21 lines
387 B
Vue
Raw Normal View History

2017-11-15 08:12:56 +00:00
<template>
<span class="user-name">{{name}}</span>
</template>
<script>
import userSvc from '../services/userSvc';
export default {
props: ['userId'],
computed: {
name() {
2018-06-21 19:16:33 +00:00
const userInfo = this.$store.state.userInfo.itemsById[this.userId];
2017-11-15 08:12:56 +00:00
return userInfo ? userInfo.name : 'Someone';
},
},
created() {
userSvc.getInfo(this.userId);
},
};
</script>