使用createBrowserHistory({basename:'/ admin'})重新加载无效。反应Js。我使用npm run start来运行应用程序。我的配置是:
output: {
path: path.resolve('dist'),
publicPath: '/admin',
filename: 'app-[hash].js'
},
devServer: {
contentBase: './',
historyApiFallback: true,
host: 'localhost',
port: 8081
},
这也是我的页面,只有重新加载才能使用斜线
<Router path='/admin' history={history} >
<div>
<Switch>
<PrivateRoute exact path="/" component={MainIndexPage} refresh={false} />
<PrivateRoute exact path="/staff" component={StaffPage} refresh={false} />
</Switch>
</div>
</Router>