html - 如何删除“#”而不会在 Ionic 中刷新页面时出错
问题描述
我正在构建一个 Ionic PWA,我在其中实现了深度链接。
IonicModule.forRoot(MyApp, {}, {
links: [
{ component: FeaturedPage, name: 'FeaturedPage', segment: ':title' },
{ component: HomePage, name: 'HomePage', segment: ':title' },
{ component: LatestPage, name: 'LatestPage', segment: ':title' },
{ component: TopPage, name: 'TopPage', segment: ':title' },
{ component: TrendingPage, name: 'TrendingPage', segment: ':title' },
{ component: ListPage, name: 'ListPage', segment: ':title' },
{ component: ItemDetailsPage, name: 'ItemDetailsPage', segment: 'Categories/:category' }
]
}),
根据要求,我必须删除“#”,所以我进行了研究,发现在下面的帮助下,我可以从 URL 中删除“#”。
import { LocationStrategy, PathLocationStrategy } from '@angular/common';
{ provide: LocationStrategy, useClass: PathLocationStrategy },
我知道,为了克服这种错误,需要在 URL 中加上“#”,但现在我不想有“#”,也不想刷新页面后出现错误,有没有人,谁能告诉我,如何摆脱这个?
解决方案
推荐阅读
- awk - 检查 GAWK 二进制字符
- .net - 是否可以从 .Net Framework 项目制作全局工具?
- c++ - C++ Hello World 程序中的错误
- android - 线性布局中的浮动操作按钮未显示
- laravel - 使用关系 laravel 从三个模型中获取数据
- python - 将 Matplotlib 图作为 QGraphicsItem/ 放入 QGraphicsView
- c++ - 使用数组上的链表排序索引列表
- python-3.x - 生成 Tk 帧时,如何将函数绑定到返回键?
- linux - 32 位/64 位 ELF 二进制文件的程序头表和节头表的大小
- linux - 尝试在 Ubuntu 18.04 上运行 Chai OpenCL 基准测试时出现多个问题