router.push 如果主窗口被隐藏,electron-vue 将无法工作
router.push electron-vue doesn't work if mainwindow is hidden
我有一个使用 Electron 和 Vuejs / Vue-router 构建的应用程序。
在我的电子 index.js 中,我有这个功能,用于隐藏 window 一旦我打开应用程序。
mainWindow.hide();
我还有一个使用 Vuejs 构建的 Splash-Page,如果用户已登录,它会进行重定向,例如:
if(this.isLogged()){
this.$router.push({name: 'logged-view'})
}else{
this.$router.push({name: 'login-view'})
}
我的问题是,如果我用 mainWindow.hide() 隐藏我的 window,启动页面会推送路由,但它永远不会创建一个组件(登录视图或日志视图)。
相反,如果我删除 mainwindow.hide() 应用程序会正确地向我的组件发送请求。
是的,我可以在重定向后进入新组件时隐藏 window,这不是我想要的行为。
如果 mainwindow 被隐藏,有没有重定向的方法?
对于其他开发者:
我已经解决了
我不再调用 mainwindow.hide(),但我已将我的 browserwindow 创建:
mainWindow = new BrowserWindow({
height: 563,
useContentSize: true,
width: 1000,
show:false // this for solve the problem of router.push() avoid mainwindow.hide()
})
我有一个使用 Electron 和 Vuejs / Vue-router 构建的应用程序。
在我的电子 index.js 中,我有这个功能,用于隐藏 window 一旦我打开应用程序。
mainWindow.hide();
我还有一个使用 Vuejs 构建的 Splash-Page,如果用户已登录,它会进行重定向,例如:
if(this.isLogged()){
this.$router.push({name: 'logged-view'})
}else{
this.$router.push({name: 'login-view'})
}
我的问题是,如果我用 mainWindow.hide() 隐藏我的 window,启动页面会推送路由,但它永远不会创建一个组件(登录视图或日志视图)。 相反,如果我删除 mainwindow.hide() 应用程序会正确地向我的组件发送请求。
是的,我可以在重定向后进入新组件时隐藏 window,这不是我想要的行为。
如果 mainwindow 被隐藏,有没有重定向的方法?
对于其他开发者:
我已经解决了
我不再调用 mainwindow.hide(),但我已将我的 browserwindow 创建:
mainWindow = new BrowserWindow({
height: 563,
useContentSize: true,
width: 1000,
show:false // this for solve the problem of router.push() avoid mainwindow.hide()
})