-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Creating the menu bar based on routes to create simple menu,
Eventually this will be done in groups
- Loading branch information
Showing
5 changed files
with
76 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<template> | ||
<div class="border-solid border-b border-gray-25 py-4 w-full flex gap-3 border-b-1"> | ||
<!-- <p>{{ menuActions }}</p> --> | ||
<div v-for="item in menuActions" :key="item.name"> | ||
<router-link v-if='item.name && item.name !== "Index"' class="primary-button" :to="{ path: item.path}"> | ||
{{item.name}} | ||
</router-link> | ||
</div> | ||
</div> | ||
</template> | ||
<script> | ||
import { routes } from '@/router/index.js'; | ||
export default { | ||
name: 'MenuBar', | ||
computed:{ | ||
menuActions(){ | ||
return routes; | ||
} | ||
}, | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,24 @@ | ||
<template> | ||
<div class="w-full xl:w-2/3 m-auto layout flex gap-8 px-4"> | ||
<aside class="w-1/3"> | ||
<div> | ||
<div> | ||
<MenuBar class="fixed bg-white z-40"></MenuBar> | ||
</div> | ||
<div class="py-16 w-full layout flex gap-8"> | ||
<aside class="fixed h-screen pl-6 pr-4 w-1/5 border-r border-solid border-gray-25"> | ||
<DocsContents></DocsContents> | ||
</aside> | ||
<div class="w-2/3"> | ||
<div class="w-1/5"></div> | ||
<div class="m-auto w-2/4"> | ||
<slot /> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
<script> | ||
import DocsContents from '@/components/DocsContents'; | ||
import MenuBar from '@/components/MenuBar'; | ||
export default { | ||
name: 'LayoutDefault', | ||
components: { DocsContents } | ||
components: { DocsContents , MenuBar } | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,58 @@ | ||
// import { routes } from '../configs/menu.config.js'; | ||
import Vue from 'vue'; | ||
import VueRouter from 'vue-router'; | ||
|
||
// let views = { path: '@/views/', format: '.vue' } | ||
|
||
|
||
Vue.use(VueRouter); | ||
|
||
const routes = [ | ||
export const routes = [ | ||
{ | ||
path: '/doc/:id', | ||
component: () => import('@/views/Doc.vue') | ||
}, | ||
{ | ||
path: '/', | ||
name: 'Index', | ||
component: () => import('../views/Index.vue') | ||
component: () => import('@/views/Index.vue') | ||
}, | ||
{ | ||
path: '/open-project/', | ||
name: 'Open project', | ||
// this component should be a dialog | ||
component: () => import('@/views/OpenProject.vue') | ||
}, | ||
{ | ||
path:'/new-project/', | ||
name: 'New project' | ||
}, | ||
{ | ||
path:'/from-folder/', | ||
name:'Create from folder' | ||
}, | ||
{ | ||
path:'//' | ||
} | ||
|
||
]; | ||
|
||
// THIS DIDNT WORK BUT IT WAS A NICE | ||
routes.forEach((action) => { | ||
if (action.name && !action.component) { | ||
// action['component'] = () => import(`${views.path}${action.name}${views.format}`); | ||
// console.log(action['component'].toString()) | ||
let path = action.name.charAt(0).toLowerCase() + action.name.slice(1); | ||
path = path.replace(/[A-Z]/g, m => "-" + m.toLowerCase()); | ||
action['path']= `/${path}/`; | ||
action['label'] = action.path.replace('-', ' '); | ||
} | ||
}); | ||
|
||
console.log(routes) | ||
|
||
const router = new VueRouter({ | ||
routes | ||
}); | ||
|
||
export default router; | ||
export default router |