user.vue 807 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <template>
  2. <!--简洁用户菜单-->
  3. <div class="right lite">
  4. <span class="name">{{ (userinfo && userinfo.name) || '管理員' }}</span>
  5. </div>
  6. </template>
  7. <script>
  8. import { mapActions, mapGetters } from 'vuex';
  9. export default {
  10. props: {
  11. menuCollapse: Boolean,
  12. },
  13. methods: {
  14. ...mapActions({
  15. logout: 'login/logout',
  16. }),
  17. async handleLogout() {
  18. // console.log(this.userinfo);
  19. // console.log(this);
  20. const res = await this.logout();
  21. // console.log(res);
  22. // if (!res.errcode) {
  23. // this.$router.push(this.$route.query.redirect || '/login');
  24. // }
  25. },
  26. },
  27. computed: {
  28. ...mapGetters(['userinfo']),
  29. },
  30. };
  31. </script>
  32. <style lang="less" scoped>
  33. .right.lite {
  34. font-size: 14px;
  35. }
  36. .el-button--text {
  37. color: white;
  38. }
  39. </style>