Blame view

src/views/dashboard/index.vue 565 Bytes
80a28914e   吉鹏   init
1
  <template>
d7d9c38c2   Adam   auto commit the c...
2
3
    <div class="dashboard-container">
      <component :is="currentRole" />
80a28914e   吉鹏   init
4
5
6
7
    </div>
  </template>
  
  <script>
d7d9c38c2   Adam   auto commit the c...
8
9
10
  import { mapGetters } from 'vuex'
  import adminDashboard from './admin'
  import editorDashboard from './editor'
80a28914e   吉鹏   init
11
12
  
  export default {
d7d9c38c2   Adam   auto commit the c...
13
14
    name: 'Dashboard',
    components: { adminDashboard, editorDashboard },
1172ebb79   Adam   auto commit the c...
15
16
    data() {
      return {
d7d9c38c2   Adam   auto commit the c...
17
18
        currentRole: 'adminDashboard'
      }
1172ebb79   Adam   auto commit the c...
19
    },
80a28914e   吉鹏   init
20
    computed: {
d7d9c38c2   Adam   auto commit the c...
21
22
23
      ...mapGetters([
        'roles'
      ])
1172ebb79   Adam   auto commit the c...
24
    },
d7d9c38c2   Adam   auto commit the c...
25
26
27
    created() {
      if (!this.roles.includes('admin')) {
        this.currentRole = 'editorDashboard'
1172ebb79   Adam   auto commit the c...
28
      }
80a28914e   吉鹏   init
29
    }
1172ebb79   Adam   auto commit the c...
30
  }
d7d9c38c2   Adam   auto commit the c...
31
  </script>