【问题标题】:Problem with open new browser using router in Vue/Electron. Redirecting to default route在 Vue/Electron 中使用路由器打开新浏览器时出现问题。重定向到默认路由
【发布时间】:2019-10-29 22:38:49
【问题描述】:

我正在尝试使用 Vue/Electron 打开一个新窗口,但新窗口是在默认路由而不是所需路由上打开的。

*navigation-drawer 上的路由运行良好。

文件:路由器/index.js

import Process from '@/components/ProcessManager/Process.vue'
export default new Router({
  routes: [
    {
      path: '/',
      name: 'home',
      component: require('@/components/LandingPage').default
    },
    {
      path: 'process',
      name: 'process',
      component: Process,
    },
    {
      path: '*',
      redirect: '/'
    }
  ]

文件:main/index.js

const processURL = process.env.NODE_ENV === 'development'
  ? `http://localhost:9080/#/process`
  : `file://${__dirname}/index.html#process`

function createWindow2 () {
  let win = new BrowserWindow({ width: 400, height: 320, webPreferences: {webSecurity: false} })
  win.loadURL(processURL)
  win.on('closed', () => {
    win = null
  })
}

【问题讨论】:

    标签: node.js vue.js electron vuetify.js


    【解决方案1】:

    看起来它加载了 index.html 但没有启动应用程序,原因在您提供的屏幕截图中的错误消息中显示。

    查看错误信息,可以阅读here这是怎么回事。

    【讨论】:

      猜你喜欢
      • 2017-07-27
      • 1970-01-01
      • 1970-01-01
      • 2012-04-12
      • 1970-01-01
      • 1970-01-01
      • 2018-02-14
      • 1970-01-01
      • 2018-04-13
      相关资源
      最近更新 更多