We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e0c25a6 commit 6782849Copy full SHA for 6782849
src/app/book/services/router.service.ts
@@ -49,7 +49,7 @@ export class RouterService {
49
let path = this._url.pathname;
50
const fragment = this._url.hash ? decodeURI(this._url.hash) : '';
51
52
- const re = new RegExp(/\.md/)
+ let re = new RegExp(/\.md/)
53
const notHomePage = re.test(path);
54
55
let url: string;
@@ -64,7 +64,10 @@ export class RouterService {
64
root = path.endsWith('/') ? path : path+'/';
65
}
66
67
- if(url.endsWith('/')) url = url.slice(0, -1);
+ // 去掉最后的 '/'
68
+ re = new RegExp(/.*\/$/);
69
+ if(re.test(url)) url = url.slice(0, -1);
70
+
71
path = url+fragment;
72
this.go(path, root);
73
0 commit comments