- poster
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
} from 'vue-router'
|
||||
|
||||
import { cfgrouter } from './route-config'
|
||||
import { useGlobalStore } from '@src/store/globalStore';
|
||||
|
||||
export default function (/* { store, ssrContext } */) {
|
||||
const routermode = process.env.VUE_ROUTER_MODE === 'history' ? createWebHistory : createWebHashHistory
|
||||
@@ -11,15 +12,32 @@ export default function (/* { store, ssrContext } */) {
|
||||
? createMemoryHistory
|
||||
: routermode
|
||||
|
||||
return createRouter({
|
||||
const router = createRouter({
|
||||
scrollBehavior: () => ({ left: 0, top: 0 }),
|
||||
routes: cfgrouter.getmenu(),
|
||||
|
||||
// Leave this as is and make changes in quasar.conf.js instead!
|
||||
// quasar.conf.js -> build -> vueRouterMode
|
||||
// quasar.conf.js -> build -> publicPath
|
||||
history: createHistory(
|
||||
process.env.MODE === 'ssr' ? void 0 : process.env.VUE_ROUTER_BASE,
|
||||
),
|
||||
})
|
||||
});
|
||||
|
||||
// Add the beforeEach hook
|
||||
router.beforeEach((to, from, next) => {
|
||||
// Execute your command before each navigation
|
||||
// executeCommand();
|
||||
|
||||
const globalStore = useGlobalStore()
|
||||
try {
|
||||
globalStore.editOn = false
|
||||
} catch(e) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Continue with the navigation
|
||||
next();
|
||||
});
|
||||
|
||||
return router;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user