Deluze / electron-vue-template

Simple Vue3 + Electron starter template in TypeScript, including ViteJS and Electron Builder
MIT License
534 stars 104 forks source link

Routing #13

Closed Dysey closed 2 years ago

Dysey commented 2 years ago

Hi,

I install vue-router and try in createWindow to change the loadFile like that

updateWindow.loadFile(Path.join(app.getAppPath(), 'renderer', 'index.html#splash'));

But got an error Not allowed to load local resource: file:///C:/laragon/www/temp/dist/win-unpacked/resources/app.asar/renderer/index.html%23splash

How I create Router

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;

Some help pls :) thx a lot

Deluze commented 2 years ago

This error you're getting has nothing to do with VueRouter itself.

You're trying to load in an index.html file with an anchor included. That's impossible.

You want to do something like:

updateWindow.loadFile(Path.join(app.getAppPath(), 'renderer', 'index.html'),  { hash: 'splash' });