We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
因为使用了 vue-router
打包后的app启动后, electron不会自动跳转到 /, 而且路由模式不能使用history 可以在 App.vue 里写死一段东西, 如果能渲染出来, 大概率就是路由问题导致的白屏
需要给成hash模式, 而且需要在loadfile的时候指定一下加载的路由
主进程代码:
mainWindow.loadFile(join(__dirname, '../renderer/index.html'), { hash: '' });
路由代码:
import { createRouter, createWebHashHistory } from 'vue-router'; const router = createRouter({ history: createWebHashHistory(import.meta.env.BASE_URL), routes: [ // youre routes ], }); export default router;
vue-router 或 react-router-dom 开发模式正常,但在构建后无效
The text was updated successfully, but these errors were encountered:
No branches or pull requests
原因
因为使用了 vue-router
原理
打包后的app启动后, electron不会自动跳转到 /, 而且路由模式不能使用history
可以在 App.vue 里写死一段东西, 如果能渲染出来, 大概率就是路由问题导致的白屏
解决方案
需要给成hash模式, 而且需要在loadfile的时候指定一下加载的路由
主进程代码:
路由代码:
参考资料
vue-router 或 react-router-dom 开发模式正常,但在构建后无效
The text was updated successfully, but these errors were encountered: