2017-11-15 08:12:56 +00:00
|
|
|
<template>
|
|
|
|
<span class="user-name">{{name}}</span>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import userSvc from '../services/userSvc';
|
2018-09-19 08:59:22 +00:00
|
|
|
import store from '../store';
|
2017-11-15 08:12:56 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
props: ['userId'],
|
|
|
|
computed: {
|
|
|
|
name() {
|
2018-09-19 08:59:22 +00:00
|
|
|
const userInfo = store.state.userInfo.itemsById[this.userId];
|
2017-11-15 08:12:56 +00:00
|
|
|
return userInfo ? userInfo.name : 'Someone';
|
|
|
|
},
|
|
|
|
},
|
2018-09-19 08:59:22 +00:00
|
|
|
watch: {
|
|
|
|
userId: {
|
|
|
|
handler: userId => userSvc.getInfo(userId),
|
|
|
|
immediate: true,
|
|
|
|
},
|
|
|
|
},
|
2017-11-15 08:12:56 +00:00
|
|
|
};
|
|
|
|
</script>
|