in src/setup-utils/SwiftDocCRenderRouter.js [20:53]
export default function createRouterInstance(routerConfig = {}) {
const router = new Router({
mode: 'history',
base: baseUrl,
scrollBehavior,
...routerConfig,
routes: routerConfig.routes || routes,
});
router.onReady(() => {
// Disable the browser's automatic scroll restoration mechanism so that it doesn't
// interfere with vue-router's scrollBehavior.
// https://github.com/vuejs/vue-router/pull/1814
if ('scrollRestoration' in window.history) {
window.history.scrollRestoration = 'manual';
}
restoreScrollOnReload();
});
if (process.env.VUE_APP_TARGET !== 'ide') {
router.onError((error) => {
const { route = { path: '/' } } = error;
router.replace({
name: 'server-error',
params: [route.path],
});
});
}
// save the scrollPosition when we quit the tab. eg: reload
window.addEventListener('unload', saveScrollOnReload);
return router;
}