File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ <template >
2+ <div >
3+ <router-link :to =" ( '/account/' + String(this.userid))" class =" color-regular-text text-normal" >{{this.username}} </router-link >
4+ </div >
5+ </template >
6+
7+ <script >
8+ import apiurl from ' ./../../apiurl' ;
9+
10+ export default {
11+ name: ' UserNameLink' ,
12+ props: {
13+ userid: {
14+ type: Number ,
15+ required: true
16+ }
17+ },
18+ data () {
19+ return {
20+ username: new String ()
21+ };
22+ },
23+ methods: {
24+ loadusername (id ) {
25+ this .$axios
26+ .get (apiurl (' /account/' + String (id)))
27+ .then (res => {
28+ this .username = res .data .res .username ;
29+ })
30+ .catch (() => {
31+ this .username = id;
32+ });
33+ }
34+ },
35+ mounted () {
36+ console .log (typeof (this .userid ));
37+ this .username = this .userid ;
38+ this .loadusername (this .userid );
39+ }
40+ };
41+ </script >
You can’t perform that action at this time.
0 commit comments