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 ce99a04 commit 784173e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ let cacheRoute = null
let cacheXhr = null

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

if (OPTIONS.alias[route]) {
return getAlias(OPTIONS.alias[route])
} else {
Expand All @@ -74,10 +72,11 @@ const mainRender = function (cb) {
}

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

if (!route) {
Expand Down

0 comments on commit 784173e

Please sign in to comment.