how to open new window #401
Comments
Your webpack should have multiple entries. |
First of all, you need to disable Then do the following: src/main/index.js example ipc.on('showChart', function (e, data) {
const modalPath = process.env.NODE_ENV === 'development'
? 'http://localhost:9080/#/showChart'
: `file://${__dirname}/index.html#showChart`
let win = new BrowserWindow({ width: 400, height: 320, webPreferences: {webSecurity: false} })
win.on('close', function () { win = null })
win.loadURL(modalPath)
}) In your router, use the exactly path to your url {
path: '/showChart',
name: 'showChart',
component: require('your-router'),
}, If your need another approach, take a look at this repo: |
it is work, thank you |
Refs #207 |
Thanks for the help @marceloavf ! |
new BrowserWindow({
width: 400,
height: 320,
webPreferences: { webSecurity: false, nodeIntegration: true },
show: false,
}); In my case it worked after adding
versions: |
@3zbumban My code like this
After build it, new window is blank when open it in the main window |
@hanjt
you also might want to check out vue-cli-plugin-electron-builder in my opinion the simplest way to use vue inside electron. |
Hey guys, I'm porting my existing 'pure' electron app over to include vue and I (successfully) implemented opening multiple windows using above approach. However I encountered some unexpected (at least for me) behavior. On the pure electron app I used to do something like this
The idea was to have some kind of landing page that you dismiss when opening the second window, but that pops back up when you close that window. When using above approach with this same setup, I noticed that I got the second window, but the first window wasn't hidden. By inserting some logs I noticed that the 'ready-to-show' is actually never fired. I can get everything working as expected when I move the two lines outside the 'ready-to-show' handler, but I'm just curious to know why this is behaving differently than what I would expect. Best, |
@marceloavf That works for me, thanks |
I have just tried this and it opens the entire app again instead of just the component I want. This is like opening a new instance of the app and setting it's router to a specified path. Is there any way to open component in a new browser window while keeping the main app settings, package, etc without reloading the entire app ? |
I want to show my chart on the new window , but below code is not work . I need to send data to the new window . how can i do , thanks.
vue is a SAP APP, so i create a new page to do this , whether has another better way?
ipc.on('showChart', function (e, data) {
const modalPath = process.env.NODE_ENV === 'development'
?
http://localhost:9080/showChart.html
:
file://${__dirname}/showChart.html
let win = new BrowserWindow({ width: 400, height: 320, webPreferences: {webSecurity: false} })
win.on('close', function () { win = null })
win.loadURL(modalPath)
})
The text was updated successfully, but these errors were encountered: