Skip to content

Commit 0aea9c5

Browse files
javoskiyyx990803
authored andcommitted
small tweak on addRouteRecord function (#1285)
* small tweak * Update create-route-map.js
1 parent 12babff commit 0aea9c5

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

src/create-route-map.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,21 +101,17 @@ function addRouteRecord (
101101
}
102102

103103
if (route.alias !== undefined) {
104-
if (Array.isArray(route.alias)) {
105-
route.alias.forEach(alias => {
106-
const aliasRoute = {
107-
path: alias,
108-
children: route.children
109-
}
110-
addRouteRecord(pathList, pathMap, nameMap, aliasRoute, parent, record.path)
111-
})
112-
} else {
104+
const aliases = Array.isArray(route.alias)
105+
? route.alias
106+
: [route.alias]
107+
108+
aliases.forEach(alias => {
113109
const aliasRoute = {
114-
path: route.alias,
110+
path: alias,
115111
children: route.children
116112
}
117113
addRouteRecord(pathList, pathMap, nameMap, aliasRoute, parent, record.path)
118-
}
114+
})
119115
}
120116

121117
if (!pathMap[record.path]) {

0 commit comments

Comments
 (0)