I’m trying to create an app with two BrowserWindows using the same Vue App with vue-router, but the router aren’t working. I’m always receiving error ‘Cannot GET /’ for the second route.
main\index.js
var mainURL = `http://localhost:9080/`
var secondURL = `http://localhost:9080/page2`
function createWindow () {
mainWindow = new BrowserWindow({
height: 600,
width: 800
})
mainWindow.loadURL(mainURL)
mainWindow.on('closed', () => {
mainWindow = null
})
secondWindow = new BrowserWindow({
height: 600,
width: 800
})
secondWindow.loadURL(secondURL)
secondWindow.on('closed', () => {
secondWindow = null
})
}
app.on('ready', createWindow)
routes.js
export default [
{
path: '/',
name: 'landing-page',
component: require('components/LandingPageView')
},
{
path: '/page2',
name: 'landing-page2',
component: require('components/LandingPageView2')
},
{
path: '*',
redirect: '/'
}
]
Testing code: https://github.com/melquic/vue-two-windows.git
Error print screen:
Thank you for help! Best.
The URL needs to be http://localhost:9080/#/page2 in order to make this work.