将<base href="/" />
替换成 <script>document.write("<base href='"+location.pathname+"' />");</script>
<!-- <base href="/" /> -->
<script>document.write("<base href='"+location.pathname+"' />");</script>
这样可以修复白屏问题 详细参考 https://www.jianshu.com/p/baacf9bce732
但是修改之后 刷新会出现404 解决办法如下:在app.module.ts中加入下面代码
//导入hash模块
import { LocationStrategy, HashLocationStrategy } from '@angular/common';
@NgModule({
//进行配置
providers: [{provide: LocationStrategy, useClass: HashLocationStrategy}],
})
详细参考:https://blog.csdn.net/qq_38002337/article/details/85225546
此文提供3中解决办法
网友评论