黄何裕
2024-08-01 e3474cf91877c95964b0d87fe55311941e601d6b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<template>
  <div class="dashboard-container">
    <div class="dashboard-text">name: {{ name }}</div>
    <el-button @click="getUserDate">登录</el-button>
  </div>
</template>
 
<script>
import { mapGetters } from "vuex";
import { login } from "@/api/user";
 
export default {
  name: "Dashboard",
  computed: {
    ...mapGetters(["name"]),
  },
  created() {
    // this.getUserDate();
  },
  methods: {
    getUserDate() {
      login({
        code: "061akYFa14JATH0EzoIa1NNVTC3akYFI"
      }
      ).then((res) => {
       localStorage.setItem('user',JSON.stringify(res.data))
      });
    },
  },
};
</script>
 
<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
</style>