0

I am calling this.$router.push({ name: "signin" }); in my Electron Vue application (in the BrowserWindow I am loading), but the page is not changing. No error message and no page change. This normally works outside of Electron.

Is the behavior of router.push different in an Electron app?

routes.js

/** @type {import('vue-router').RouterOptions['routes']} */
export const routes = [
    {
        path: '/',
        component: require('./App.vue')
    },
    {
        path: "/signin",
        name: "signin",
        component: require('./views/SignIn.vue')
    },

    /* NOT FOUND */
    { path: "/:path(.*)", component: () => import("./views/NotFound.vue") },
];

main.js

import { createApp } from 'vue'
import { createRouter, createWebHistory } from "vue-router";
import App from './App.vue'
import { routes } from "./routes.js";
    
    
const app = createApp(App)
    
// create vue router
const router = createRouter({ history: createWebHistory(), routes })

app.use(router)
app.mount('#app')
midnight-coding
  • 2,857
  • 2
  • 17
  • 27
user2500558
  • 73
  • 3
  • 10

1 Answers1

0

Change history property

history: createWebHistory()

to

history: createWebHashHistory()

Documentation