【发布时间】:2017-10-04 10:58:36
【问题描述】:
我正在尝试使用带有 vue-router 的同一个 Vue 应用程序创建一个包含两个 BrowserWindows 的应用程序,但路由器无法正常工作。我总是收到第二条路线的错误“Cannot GET /”。
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: '/'
}
]
测试代码:https://github.com/melquic/vue-two-windows.git
错误打印屏幕:
感谢您的帮助! 最好的。
【问题讨论】:
-
vuejs的路由问题详情可以从router.vuejs.org/guide/essentials/…找到
标签: electron vuejs2 vue-router