mirror of
https://github.com/aljazceru/meshcore-web.git
synced 2025-12-19 00:54:21 +01:00
preload routes
This commit is contained in:
17
src/main.js
17
src/main.js
@@ -5,9 +5,7 @@ import "./style.css";
|
||||
|
||||
import App from './components/App.vue';
|
||||
|
||||
const router = createRouter({
|
||||
history: createMemoryHistory(),
|
||||
routes: [
|
||||
const routes = [
|
||||
{
|
||||
name: "main",
|
||||
path: '/',
|
||||
@@ -29,9 +27,20 @@ const router = createRouter({
|
||||
path: '/settings/radio',
|
||||
component: () => import("./components/pages/RadioSettingsPage.vue"),
|
||||
},
|
||||
],
|
||||
];
|
||||
|
||||
const router = createRouter({
|
||||
history: createMemoryHistory(),
|
||||
routes: routes,
|
||||
});
|
||||
|
||||
// preload all route components, so they are available even if the server deploys a new version before the user navigates to a page
|
||||
for(const route of routes){
|
||||
if(typeof route.component === 'function'){
|
||||
route.component();
|
||||
}
|
||||
}
|
||||
|
||||
createApp(App)
|
||||
.use(router)
|
||||
.use(vClickOutside)
|
||||
|
||||
Reference in New Issue
Block a user