route 精确匹配
This commit is contained in:
parent
e058321490
commit
a2a7810c8a
|
@ -24,7 +24,7 @@ export const render = async (req,res)=>{
|
|||
function matchSubRoutes(routes, url) {
|
||||
for (const route of routes) {
|
||||
// 检查当前路由是否匹配
|
||||
let match = matchPath(url, route.path);
|
||||
let match = matchPath(url, { path: route.path, exact: true });
|
||||
if (match) {
|
||||
// 如果当前路由匹配,并且它有子路由,递归检查子路由
|
||||
if (route.routes) {
|
||||
|
|
Loading…
Reference in New Issue