Skip to content

Commit

Permalink
fix(src): get alias
Browse files Browse the repository at this point in the history
  • Loading branch information
QingWei-Li committed Feb 12, 2017
1 parent 772972c commit ce99a04
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ render.init()
let cacheRoute = null
let cacheXhr = null

const getAlias = function (route) {
route = route.replace(/\/+/, '/')

if (OPTIONS.alias[route]) {
return getAlias(OPTIONS.alias[route])
} else {
return route
}
}

const mainRender = function (cb) {
let page
let route = utils.getRoute()
Expand All @@ -65,7 +75,7 @@ const mainRender = function (cb) {

// replace route
if (OPTIONS.alias && OPTIONS.alias['/' + route]) {
route = OPTIONS.alias['/' + route]
route = getAlias('/' + route)
} else {
route = OPTIONS.basePath + route
}
Expand Down

0 comments on commit ce99a04

Please sign in to comment.