我正在一个电子项目与创建反应应用程序工作。这个应用程序在开发中运行得很好。当我用电子生成器打包应用程序时,我可以登录到用户帐户。但是,当我退出并重定向到/signin路由时,我会得到一个空白屏幕。当我检查“网络”选项卡时,会得到找不到/signin文件的错误。
我的package.json的构建部分
"files": [
"build/**/**/*",
{
"from": "dist/src",
"to": "src",
"filter": [
"**/**/*"
]
},
"node_modules/**/*",
"./main.js"
],main.js文件
const path = require('path');
const url = require('url');
const { app, BrowserWindow } = require('electron');
let mainWindow;
function createWindow() {
mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true,
},
});
const startUrl =
process.env.ELECTRON_START_URL ||
url.format({
pathname: path.join(__dirname, './build/index.html'),
protocol: 'file:',
slashes: true,
});
mainWindow.loadURL(startUrl);
mainWindow.webContents.openDevTools();
mainWindow.on('closed', function () {
mainWindow = null;
});
}
app.on('ready', createWindow);
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', function () {
if (mainWindow === null) {
createWindow();
}
});
require('./src/server/helpers/ipcMainHandler.js');我正在使用哈希路由器进行路由.
我做错什么了?
发布于 2021-01-04 08:05:27
这个问题已经解决了。我发现注销方法被设置为使用window.location.href重定向。
我将历史作为参数传递给注销函数,并使用push方法使其工作。
https://stackoverflow.com/questions/65555158
复制相似问题