Skip to content

Commit ce99a04

Browse files
committed
fix(src): get alias
1 parent 772972c commit ce99a04

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/index.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@ render.init()
5050
let cacheRoute = null
5151
let cacheXhr = null
5252

53+
const getAlias = function (route) {
54+
route = route.replace(/\/+/, '/')
55+
56+
if (OPTIONS.alias[route]) {
57+
return getAlias(OPTIONS.alias[route])
58+
} else {
59+
return route
60+
}
61+
}
62+
5363
const mainRender = function (cb) {
5464
let page
5565
let route = utils.getRoute()
@@ -65,7 +75,7 @@ const mainRender = function (cb) {
6575

6676
// replace route
6777
if (OPTIONS.alias && OPTIONS.alias['/' + route]) {
68-
route = OPTIONS.alias['/' + route]
78+
route = getAlias('/' + route)
6979
} else {
7080
route = OPTIONS.basePath + route
7181
}

0 commit comments

Comments
 (0)