diff --git a/src/components/Header.vue b/src/components/Header.vue index 12f940e..4ea2a8f 100644 --- a/src/components/Header.vue +++ b/src/components/Header.vue @@ -11,7 +11,7 @@ - {{ userInfo.name }} + {{ userInfo.username }} - - + diff --git a/src/views/login/Index.vue b/src/views/login/Index.vue index 5fc8e9e..3a5d0a0 100644 --- a/src/views/login/Index.vue +++ b/src/views/login/Index.vue @@ -51,7 +51,10 @@ export default { alert('用户登录成功'); console.log(data.data); const token = data.data; + const username = data.username; + console.log(token, username); sessionStorage.setItem('token', token); + sessionStorage.setItem('username', username); await router.push('/home'); } else { alert(data.message);