File tree Expand file tree Collapse file tree 7 files changed +70
-11
lines changed Expand file tree Collapse file tree 7 files changed +70
-11
lines changed Original file line number Diff line number Diff line change 1
- @import 'base.less'
1
+ @import 'base.less';
Original file line number Diff line number Diff line change 4
4
* @Author: wenlan
5
5
* @Date: 2022-01-27 22:29:28
6
6
* @LastEditors: wenlan
7
- * @LastEditTime: 2022-02-06 21:02:44
7
+ * @LastEditTime: 2022-02-06 21:01:12
8
8
-->
9
9
<script setup lang="ts">
10
10
import { PermissionModule } from '@/store/premission/index'
@@ -16,7 +16,8 @@ const route = useRoute()
16
16
const routes = computed(() => {
17
17
return PermissionModule.routes
18
18
})
19
- computed
19
+ console.log('route', route)
20
+ //computed
20
21
const activeMenu = computed(() => {
21
22
const { meta, name } = route
22
23
// if set path, the sidebar will highlight the path you set
Original file line number Diff line number Diff line change 4
4
* @Author: wenlan
5
5
* @Date: 2022-01-15 16:55:13
6
6
* @LastEditors: wenlan
7
- * @LastEditTime: 2022-02-05 13:11:41
7
+ * @LastEditTime: 2022-02-07 16:04:51
8
8
*/
9
9
import { createRouter, createWebHashHistory } from 'vue-router'
10
10
import type { RouteRecordRaw } from 'vue-router'
@@ -168,4 +168,6 @@ export function resetRouter() {
168
168
;(router as any).matcher = (newRouter as any).matcher // reset router
169
169
}
170
170
171
+ console.log('路由', router.getRoutes())
172
+
171
173
export default router
Original file line number Diff line number Diff line change 4
4
* @Author: wenlan
5
5
* @Date: 2022-01-23 17:12:21
6
6
* @LastEditors: wenlan
7
- * @LastEditTime: 2022-02-06 21:04:01
7
+ * @LastEditTime: 2022-02-07 14:35:33
8
8
-->
9
9
<script setup lang="ts">
10
- import { markRaw, ref } from 'vue'
10
+ import { ref } from 'vue'
11
11
import NavHeader from '@/components/nav-header'
12
12
import NavMenu from '@/components/nav-menu'
13
13
import { useRoute } from 'vue-router'
14
- const route = markRaw(useRoute())
15
14
let ISCollapse = ref<boolean>(false)
15
+ const route = useRoute()
16
16
// eslint-disable-next-line @typescript-eslint/no-unused-vars
17
17
const handleCollapse = (isCollapse: boolean) => {
18
18
console.log(isCollapse)
@@ -31,14 +31,33 @@ const handleCollapse = (isCollapse: boolean) => {
31
31
<nav-header @change-collapse="handleCollapse"></nav-header>
32
32
</el-header>
33
33
<el-main class="page-content">
34
- <router-view :key="route.path"> </router-view>
34
+ <router-view v-slot="{ Component }">
35
+ <transition name="why" appear>
36
+ <div :key="(route.name as string)">
37
+ <component :is="Component"></component>
38
+ </div>
39
+ </transition>
40
+ </router-view>
35
41
</el-main>
36
42
</el-container>
37
43
</el-container>
38
44
</div>
39
45
</template>
40
46
41
47
<style scoped lang="less">
48
+ .why-active {
49
+ color: red;
50
+ }
51
+
52
+ .why-enter-from,
53
+ .why-leave-to {
54
+ opacity: 0;
55
+ }
56
+
57
+ .why-enter-active,
58
+ .why-leave-active {
59
+ transition: opacity 1s ease;
60
+ }
42
61
.main {
43
62
position: fixed;
44
63
top: 0;
Original file line number Diff line number Diff line change
1
+ <!--
2
+ * @Descripttion:
3
+ * @version:
4
+ * @Author: wenlan
5
+ * @Date: 2022-02-07 16:24:32
6
+ * @LastEditors: wenlan
7
+ * @LastEditTime: 2022-02-07 16:25:47
8
+ -->
9
+ <script setup lang="ts"></script>
10
+
11
+ <template><h1>admin</h1></template>
12
+
13
+ <style scoped></style>
Original file line number Diff line number Diff line change 4
4
* @Author: wenlan
5
5
* @Date: 2022-02-03 10:50:45
6
6
* @LastEditors: wenlan
7
- * @LastEditTime: 2022-02-03 10:50:48
7
+ * @LastEditTime: 2022-02-07 16:42:49
8
8
-->
9
- <script setup lang="ts"></script>
9
+ <script setup lang="ts">
10
+ import { LoginModule } from '@/store/login/index'
11
+ import { computed } from 'vue'
12
+ import AdminDashboard from './admin/index.vue'
13
+ import EditorDashboard from './editor/index.vue'
14
+ let currentRole = computed(() => {
15
+ return LoginModule.roles.includes('admin') ? AdminDashboard : EditorDashboard
16
+ })
17
+ </script>
10
18
11
19
<template>
12
- <h1>首页</h1>
20
+ <div class="dashboard-container">
21
+ <component :is="currentRole" />
22
+ </div>
13
23
</template>
14
24
15
25
<style scoped></style>
Original file line number Diff line number Diff line change
1
+ <!--
2
+ * @Descripttion:
3
+ * @version:
4
+ * @Author: wenlan
5
+ * @Date: 2022-02-07 16:24:41
6
+ * @LastEditors: wenlan
7
+ * @LastEditTime: 2022-02-07 16:25:52
8
+ -->
9
+ <script setup lang="ts"></script>
10
+ <template>
11
+ <h1>Editor</h1>
12
+ </template>
13
+
14
+ <style scoped></style>
You can’t perform that action at this time.
0 commit comments