该问题分为两种情况:
一、有源码,那么按照官网教程修改,并重新打包即可 Angular。
二、没有源码,只有编译后的项目,此时可按如下步骤修改:
1.修正angular 路由跳转问题,通过在不切换页面的情况下修改浏览器地址实现。
例如 当前部署的路径是 http://localhost/some-project/index.html,通过如下代码在浏览器加载到http://localhost/some-project/index.html 后将浏览器地址设置为 http://localhost/,在 head 中添加如下代码:
<script>
window.history.replaceState({}, 'my title', '/');
</script>
2.定义baseUrl,在 head 中添加如下代码:
<base href="./"/>
3.修改所有相对跟目录的资源访问为相对 baseUrl,例如:
<img src="/assets/img/ionic-react-icon.png">
|
V
<img src="assets/img/ionic-react-icon.png">