2017-05-05 3 views
0

vue-router와 동일한 Vue App을 사용하는 두 개의 BrowserWindows로 앱을 만들려고하지만 라우터가 작동하지 않습니다. 나는 항상 두 번째 경로로 'Can not GET /'오류를 받는다.VUE 라우터가 2 개의 Electron BrowserWindows에서 작동하지 않습니다.

주요 \하는 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

오류 화면 인쇄 :

enter image description here

도움 주셔서 감사합니다. 최고.

답변

1

이 작업을 수행하려면 URL이 http://localhost:9080/#/page2이어야합니다.

+0

'기록'모드를 사용해 볼 수도 있습니다. https://router.vuejs.org/ko/api/options.html – Bert