mirror of
https://github.com/youzan/vant.git
synced 2025-10-22 11:54:02 +00:00
fix(cli): nav route matching
This commit is contained in:
@@ -52,7 +52,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
base() {
|
base() {
|
||||||
return this.lang ? `/${this.lang}` : '';
|
return this.lang ? `/${this.lang}/` : '/';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@@ -20,8 +20,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
path() {
|
path() {
|
||||||
const { path } = this.item;
|
return `${this.base}${this.item.path}`;
|
||||||
return this.base ? `${this.base}/${path}` : path;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
active() {
|
active() {
|
||||||
|
@@ -74,6 +74,7 @@ function getRoutes() {
|
|||||||
addHomeRoute(documents[name], lang);
|
addHomeRoute(documents[name], lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (lang) {
|
||||||
routes.push({
|
routes.push({
|
||||||
name: `${lang}/${component}`,
|
name: `${lang}/${component}`,
|
||||||
path: `/${lang}/${component}`,
|
path: `/${lang}/${component}`,
|
||||||
@@ -83,6 +84,16 @@ function getRoutes() {
|
|||||||
name: component
|
name: component
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
routes.push({
|
||||||
|
name: `${component}`,
|
||||||
|
path: `/${component}`,
|
||||||
|
component: documents[name],
|
||||||
|
meta: {
|
||||||
|
name: component
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return routes;
|
return routes;
|
||||||
|
@@ -46,7 +46,7 @@ function getRoutes() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
routes.push({
|
routes.push({
|
||||||
path: '',
|
path: '/',
|
||||||
component: DemoHome
|
component: DemoHome
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user