从cookie中取出用户
This commit is contained in:
parent
89fd3c1f6b
commit
163912046b
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<el-dropdown size="medium" @command="handleCommand">
|
<el-dropdown size="medium" @command="handleCommand">
|
||||||
<span class="dropdown-link">
|
<span class="dropdown-link">
|
||||||
莫 鹍<i class="el-icon-caret-bottom el-icon--right"/>
|
{{currentUser.name}}<i class="el-icon-caret-bottom el-icon--right"/>
|
||||||
</span>
|
</span>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
<el-dropdown-item command="personal">个人信息</el-dropdown-item>
|
<el-dropdown-item command="personal">个人信息</el-dropdown-item>
|
||||||
|
@ -11,8 +11,18 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import Cookies from 'js-cookie';
|
||||||
|
|
||||||
|
const TokenKey = 'Admin-Token';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsUser",
|
name: "MsUser",
|
||||||
|
computed: {
|
||||||
|
currentUser: () => {
|
||||||
|
let user = Cookies.get(TokenKey);
|
||||||
|
return JSON.parse(user);
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleCommand(command) {
|
handleCommand(command) {
|
||||||
switch (command) {
|
switch (command) {
|
||||||
|
|
Loading…
Reference in New Issue