Forráskód Böngészése

Add nested routes; redirect /admin to /admin/dashboard

sbkwgh 8 éve
szülő
commit
66cbae4ec9

+ 17 - 0
src/components/routes/AdminDashboard.vue

@@ -0,0 +1,17 @@
+<template>
+	<div class='route_container'>
+	</div>
+</template>
+
+<script>
+	export default {
+		name: 'adminDashboard',
+		components: {},
+		computed: {},
+		methods: {}
+	}
+</script>
+
+<style lang='scss' scoped>
+	@import '../../assets/scss/variables.scss';
+</style>

+ 17 - 0
src/components/routes/AdminSettings.vue

@@ -0,0 +1,17 @@
+<template>
+	<div class='route_container'>
+	</div>
+</template>
+
+<script>
+	export default {
+		name: 'adminSettings',
+		components: {},
+		computed: {},
+		methods: {}
+	}
+</script>
+
+<style lang='scss' scoped>
+	@import '../../assets/scss/variables.scss';
+</style>

+ 17 - 0
src/components/routes/AdminUsers.vue

@@ -0,0 +1,17 @@
+<template>
+	<div class='route_container'>
+	</div>
+</template>
+
+<script>
+	export default {
+		name: 'adminUsers',
+		components: {},
+		computed: {},
+		methods: {}
+	}
+</script>
+
+<style lang='scss' scoped>
+	@import '../../assets/scss/variables.scss';
+</style>

+ 8 - 3
src/main.js

@@ -10,8 +10,9 @@ import Category from './components/routes/Category'
 import Thread from './components/routes/Thread'
 import ThreadNew from './components/routes/ThreadNew'
 import Admin from './components/routes/Admin'
-import Admin from './components/routes/Admin'
-import Admin from './components/routes/Admin'
+import AdminDashboard from './components/routes/AdminDashboard'
+import AdminUsers from './components/routes/AdminUsers'
+import AdminSettings from './components/routes/AdminSettings'
 
 import onResize from './assets/js/flexBoxGridCorrect'
 
@@ -26,7 +27,11 @@ const router = new VueRouter({
 		{ path: '/category/:category', component: Category },
 		{ path: '/thread/:slug/:id', component: Thread },
 		{ path: '/thread/new', component: ThreadNew },
-		{ path: '/admin', component: Admin }
+		{ path: '/admin', redirect: '/admin/dashboard', component: Admin, children: [
+			{ path: 'dashboard', component: AdminDashboard },
+			{ path: 'settings', component: AdminSettings },
+			{ path: 'users', component: AdminUsers }
+		] }
 	],
 	mode: 'history'
 })