navigation wip

This commit is contained in:
jbnadal
2018-05-23 18:45:13 +02:00
parent c5f19f852f
commit f062088d9b
9 changed files with 94 additions and 7 deletions

View File

@@ -13,6 +13,7 @@
</template>
<script>
export default {
// name: 'ComponentName',
data () {

View File

@@ -2,7 +2,7 @@
<q-layout view="lHh Lpr lFf">
<q-layout-header>
<q-toolbar :inverted="$q.theme === 'ios'">
<q-toolbar-title> Domo </q-toolbar-title>
<q-toolbar-title> {{ pageMeta.title }} </q-toolbar-title>
</q-toolbar>
</q-layout-header>
<q-layout-footer reveal v-if="$q.theme === 'ios'">
@@ -24,6 +24,8 @@
<script>
import DomoTabs from 'components/domo-tabs'
import { mapState } from 'vuex'
export default {
name: 'LayoutDefault',
components: {
@@ -33,6 +35,11 @@ export default {
return {
}
},
computed: {
...mapState('domoStore', [
'pageMeta'
])
},
methods: {
resetScroll (el, done) {
document.documentElement.scrollTop = 0

View File

@@ -1,6 +1,7 @@
import Vue from 'vue'
import VueRouter from 'vue-router'
import store from 'src/store'
import routes from './routes'
Vue.use(VueRouter)
@@ -21,4 +22,20 @@ const Router = new VueRouter({
routes
})
Router.beforeEach((to, from, next) => {
if (to.meta) {
store.commit('domoStore/updatePageMeta', to.meta)
}
/*
// Inform Google Analytics
if (typeof ga !== 'undefined') {
ga('set', 'page', to.path)
ga('send', 'pageview')
}
*/
next()
})
export default Router

View File

@@ -4,12 +4,36 @@ export default [
path: '/',
component: () => import('layouts/default'),
children: [
{ path: '', component: () => import('pages/home') },
{ path: '/outlets', component: () => import('pages/outlets') },
{ path: '/shutters', component: () => import('pages/shutters') },
{ path: '/sprinklers', component: () => import('pages/sprinklers') },
{ path: '/sequences', component: () => import('pages/sequences') },
{ path: '/settings', component: () => import('pages/settings') }
{ path: '',
meta: {
title: 'Domo'
},
component: () => import('pages/home') },
{ path: '/outlets',
meta: {
title: 'Outlets'
},
component: () => import('pages/outlets') },
{ path: '/shutters',
meta: {
title: 'Shutters'
},
component: () => import('pages/shutters') },
{ path: '/sprinklers',
meta: {
title: 'Sprinklers'
},
component: () => import('pages/sprinklers') },
{ path: '/sequences',
meta: {
title: 'Sequences'
},
component: () => import('pages/sequences') },
{ path: '/settings',
meta: {
title: 'Settings'
},
component: () => import('pages/settings') }
]
},

View File

@@ -0,0 +1,3 @@
/*
export const someAction = (state) => {}
*/

View File

@@ -0,0 +1,3 @@
/*
export const someGetter = (state) => {}
*/

View File

@@ -0,0 +1,12 @@
import state from './state'
import * as getters from './getters'
import * as mutations from './mutations'
import * as actions from './actions'
export default {
namespaced: true,
state,
getters,
mutations,
actions
}

View File

@@ -0,0 +1,16 @@
export const updateDrawerState = (state, opened) => {
state.drawerState = opened
}
export const updatePageMeta = (state, meta) => {
state.pageMeta = {
title: 'Domo',
hash: '',
icon: '',
iframeTabs: false,
backRoute: '/',
tabs: [],
...meta
}
}

View File

@@ -0,0 +1,4 @@
export default {
drawerState: true,
pageMeta: {}
}