forked from epicmaxco/vuestic-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(routes): basic menu items in store
- Loading branch information
1 parent
7dd9633
commit 1b367ef
Showing
9 changed files
with
80 additions
and
3 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
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,5 @@ | ||
const menuitems = state => state.menu.items | ||
|
||
export { | ||
menuitems | ||
} |
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,38 @@ | ||
import * as types from '../../mutation-types' | ||
import lazyLoading from './lazyLoading' | ||
import statistics from './statistics' | ||
|
||
// show: meta.label -> name | ||
// name: component name | ||
// meta.label: display label | ||
|
||
const state = { | ||
items: [ | ||
{ | ||
name: 'Dashboard', | ||
path: '/dashboard', | ||
meta: { | ||
icon: 'fa-tachometer' | ||
}, | ||
component: lazyLoading('dashboard/Dashboard') | ||
}, | ||
statistics | ||
] | ||
} | ||
|
||
const mutations = { | ||
[types.EXPAND_MENU] (state, menuItem) { | ||
if (menuItem.index > -1) { | ||
if (state.items[menuItem.index] && state.items[menuItem.index].meta) { | ||
state.items[menuItem.index].meta.expanded = menuItem.expanded | ||
} | ||
} else if (menuItem.item && 'expanded' in menuItem.item.meta) { | ||
menuItem.item.meta.expanded = menuItem.expanded | ||
} | ||
} | ||
} | ||
|
||
export default { | ||
state, | ||
mutations | ||
} |
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,3 @@ | ||
// lazy loading Components | ||
// https://github.com/vuejs/vue-router/blob/dev/examples/lazy-loading/app.js#L8 | ||
export default (name, index = false) => () => import(`components/${name}${index ? '/index' : ''}.vue`) |
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,23 @@ | ||
import lazyLoading from './lazyLoading' | ||
|
||
export default { | ||
name: 'Statistics', | ||
path: '/statistics', | ||
meta: { | ||
expanded: false | ||
}, | ||
component: lazyLoading('charts', true), | ||
|
||
children: [ | ||
{ | ||
name: 'Charts', | ||
path: 'charts', | ||
component: lazyLoading('statistics/charts/Charts') | ||
}, | ||
{ | ||
name: 'ProgressBars', | ||
path: 'progress-bars', | ||
component: lazyLoading('statistics/progress-bars/ProgressBars') | ||
} | ||
] | ||
} |
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 @@ | ||
export const EXPAND_MENU = 'EXPAND_MENU' |