forked from juan/hedera-web
38 lines
833 B
JavaScript
38 lines
833 B
JavaScript
import Vue from 'vue'
|
|
import VueRouter from 'vue-router'
|
|
|
|
import routes from './routes'
|
|
|
|
Vue.use(VueRouter)
|
|
|
|
/*
|
|
* If not building with SSR mode, you can
|
|
* directly export the Router instantiation
|
|
*/
|
|
|
|
export default function (/* { store, ssrContext } */) {
|
|
const Router = new VueRouter({
|
|
scrollBehavior: () => ({ y: 0 }),
|
|
routes,
|
|
|
|
// Leave these as is and change from quasar.conf.js instead!
|
|
// quasar.conf.js -> build -> vueRouterMode
|
|
// quasar.conf.js -> build -> publicPath
|
|
mode: process.env.VUE_ROUTER_MODE,
|
|
base: process.env.VUE_ROUTER_BASE
|
|
})
|
|
|
|
Router.afterEach((to, from) => {
|
|
let app = Router.app
|
|
let $state = app.$state
|
|
|
|
if (from.name !== to.name) {
|
|
$state.title = app.$t(to.name)
|
|
$state.titleColor = null
|
|
$state.subtitle = null
|
|
}
|
|
})
|
|
|
|
return Router
|
|
}
|