Default to Lara when navigation to home
parent
ff7b4e8eac
commit
0e1712ebbe
|
@ -105,6 +105,8 @@ import AppDemoActions from './AppDemoActions';
|
||||||
import AppDocumentation from './AppDocumentation';
|
import AppDocumentation from './AppDocumentation';
|
||||||
import CodeHighlight from './AppCodeHighlight';
|
import CodeHighlight from './AppCodeHighlight';
|
||||||
|
|
||||||
|
import EventBus from '@/AppEventBus';
|
||||||
|
|
||||||
import './assets/styles/primevue.css';
|
import './assets/styles/primevue.css';
|
||||||
import 'primeflex/primeflex.css';
|
import 'primeflex/primeflex.css';
|
||||||
import 'primeicons/primeicons.css';
|
import 'primeicons/primeicons.css';
|
||||||
|
@ -112,7 +114,10 @@ import 'prismjs/themes/prism-coy.css';
|
||||||
import './assets/styles/flags.css';
|
import './assets/styles/flags.css';
|
||||||
|
|
||||||
router.beforeEach(function (to, from, next) {
|
router.beforeEach(function (to, from, next) {
|
||||||
window.scrollTo(0, 0);
|
if (to.name === 'home' && from.name) {
|
||||||
|
const newTheme = app.config.globalProperties.$appState.darkTheme ? 'lara-dark-indigo' : 'lara-light-indigo';
|
||||||
|
EventBus.emit('theme-change', { theme: newTheme, dark: app.config.globalProperties.$appState.darkTheme });
|
||||||
|
}
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -840,7 +840,10 @@ const routes = [
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHashHistory(),
|
history: createWebHashHistory(),
|
||||||
routes,
|
routes,
|
||||||
scrollBehavior () {
|
scrollBehavior (to, from, savedPosition) {
|
||||||
|
if (savedPosition)
|
||||||
|
return savedPosition
|
||||||
|
else
|
||||||
return { left: 0, top: 0 };
|
return { left: 0, top: 0 };
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue