Skip to content

Commit

Permalink
Update route param type
Browse files Browse the repository at this point in the history
  • Loading branch information
rayc2045 committed Apr 30, 2024
1 parent 21ee4da commit 281d3ff
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,11 @@ const router = {
const routePathFrags = this.currentRoute.path.split('/'),
currentPathFrags = this.currentPath.split('/');
for (let i = 0; i < routePathFrags.length; i++)
if (routePathFrags[i] !== currentPathFrags[i])
param[routePathFrags[i].split(':')[1]] = currentPathFrags[i];
if (routePathFrags[i] !== currentPathFrags[i]) {
const prop = routePathFrags[i].split(':')[1],
value = currentPathFrags[i];
param[prop] = isNaN(+value) ? value : +value;
}
return param;
},
async init() {
Expand Down

0 comments on commit 281d3ff

Please sign in to comment.