在Vue / Electron中使用路由器打开新浏览器时出现问题。重定向到默认路由

时间:2019-06-15 17:26:23

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

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

*导航抽屉上的路线运行良好。

文件:router / 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: '/'
    }
  ]

file: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
  })
}

Windows opening on same route

1 个答案:

答案 0 :(得分:0)

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

查看错误消息,您可以阅读here的情况。