Skip to content

Commit 9223942

Browse files
committed
渲染用户名及头像
1 parent 67cd980 commit 9223942

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/components/user.vue

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
<div class="user-info">
33
<div class="user-name">
44
<div class="user-avatar">
5-
<img src="http://vueim-10073389.image.myqcloud.com//u/can/use/slash/sample1479377386" class="img"></img>
5+
<img v-bind:src='url' class="img"></img>
66
</div>
77
<div class="user-nickname">
8-
<span>An</span>
8+
<span>{{username}}</span>
99
<i></i>
1010
</div>
1111
</div>
@@ -46,13 +46,30 @@
4646
</template>
4747
4848
<script>
49+
import { getLoginId } from '../vuex/getters'
50+
import settings from '../settings.js'
4951
export default {
5052
data: function() {
5153
return {
54+
url: '',
55+
username: ''
5256
}
5357
},
5458
methods: {
5559
},
60+
ready: function() {
61+
this.$http.post(settings.server+'/getUserInfo', { username: this.loginId }).then((res) => {
62+
let result = res.data.data.user
63+
this.url = result.url
64+
console.log(result)
65+
this.username = result.username
66+
})
67+
},
68+
vuex: {
69+
getters: {
70+
loginId: getLoginId
71+
}
72+
},
5673
5774
}
5875
</script>

0 commit comments

Comments
 (0)