Source: router.js

import { createMemoryHistory, createRouter, createWebHistory } from 'vue-router';
import Home from './components/home.vue';
import About from './components/about.vue';
const routes = [
  { path: '/', name: "Home", component: Home, meta : { title: 'Home', icon: 'home' } },
  { path: '/about', name: "About", component: About, meta: { title: 'About', icon: 'info' } },
];

const router = createRouter({
  history: createWebHistory(),
  //history: createMemoryHistory(),
  routes: routes,
});

router.beforeEach((to, from, next) => {
  const store = router.app.config.globalProperties.$store;

  if (store.popups.help.show) {
    store.popups.help.show = false;
    next(false);
    return;
  }

  if (store.popups.imageViewer.show) {
    store.popups.imageViewer.show = false;
    next(false);
    return;
  }

  if (store.popup.show) {
    store.popup.show = false;
    next(false);
    return;  
  }
  next();
});

export default router;