@@ -27,15 +27,15 @@ const advanceAPI = import.meta.glob('./advance/api.*.json', { eager: true, impor
2727const routes : Array < RouteDefinition & { kind : Kind } > = [
2828 {
2929 kind : 'intro' ,
30- path : [ '/ ' , '/ intro/readme' ] ,
30+ path : [ '' , 'intro/readme' ] ,
3131 info : { title : '_d.docs.intro' } ,
3232 component : ( ) => (
3333 < Doc articles = { import . meta. glob ( '../../../../README.md' , { eager : true , query : '?raw' , import : 'default' } ) } />
3434 ) ,
3535 } ,
3636 {
3737 kind : 'intro' ,
38- path : '/ intro/changelog' ,
38+ path : 'intro/changelog' ,
3939 info : { title : '_d.docs.changelog' } ,
4040 component : ( ) => (
4141 < Doc articles = { import . meta. glob ( '../../../../CHANGELOG.md' , { eager : true , query : '?raw' , import : 'default' } ) } />
@@ -46,7 +46,7 @@ const routes: Array<RouteDefinition & { kind: Kind }> = [
4646
4747 {
4848 kind : 'usage' ,
49- path : '/ usage/install' ,
49+ path : 'usage/install' ,
5050 info : { title : '_d.docs.install' } ,
5151 component : ( ) => (
5252 < Doc
@@ -57,7 +57,7 @@ const routes: Array<RouteDefinition & { kind: Kind }> = [
5757 } ,
5858 {
5959 kind : 'usage' ,
60- path : '/ usage/platform' ,
60+ path : 'usage/platform' ,
6161 info : { title : '_d.docs.platform' } ,
6262 component : ( ) => (
6363 < Doc
@@ -68,7 +68,7 @@ const routes: Array<RouteDefinition & { kind: Kind }> = [
6868 } ,
6969 {
7070 kind : 'usage' ,
71- path : '/ usage/svg' ,
71+ path : 'usage/svg' ,
7272 info : { title : '_d.docs.svg' } ,
7373 component : ( ) => (
7474 < Doc
@@ -79,7 +79,7 @@ const routes: Array<RouteDefinition & { kind: Kind }> = [
7979 } ,
8080 {
8181 kind : 'usage' ,
82- path : '/ usage/theme' ,
82+ path : 'usage/theme' ,
8383 info : { title : '_d.docs.theme' } ,
8484 component : ( ) => (
8585 < Doc
@@ -90,7 +90,7 @@ const routes: Array<RouteDefinition & { kind: Kind }> = [
9090 } ,
9191 {
9292 kind : 'usage' ,
93- path : '/ usage/faq' ,
93+ path : 'usage/faq' ,
9494 info : { title : '_d.docs.faq' } ,
9595 component : ( ) => (
9696 < Doc
@@ -104,7 +104,7 @@ const routes: Array<RouteDefinition & { kind: Kind }> = [
104104
105105 {
106106 kind : 'advance' ,
107- path : '/ advance/locale' ,
107+ path : 'advance/locale' ,
108108 info : { title : '_d.docs.locale' } ,
109109 component : ( ) => (
110110 < Doc
@@ -115,7 +115,7 @@ const routes: Array<RouteDefinition & { kind: Kind }> = [
115115 } ,
116116 {
117117 kind : 'advance' ,
118- path : '/ advance/validator' ,
118+ path : 'advance/validator' ,
119119 info : { title : '_d.docs.validator' } ,
120120 component : ( ) => (
121121 < Doc
@@ -126,7 +126,7 @@ const routes: Array<RouteDefinition & { kind: Kind }> = [
126126 } ,
127127 {
128128 kind : 'advance' ,
129- path : '/ advance/error' ,
129+ path : 'advance/error' ,
130130 info : { title : '_d.docs.error' } ,
131131 component : ( ) => (
132132 < Doc
@@ -137,7 +137,7 @@ const routes: Array<RouteDefinition & { kind: Kind }> = [
137137 } ,
138138 {
139139 kind : 'advance' ,
140- path : '/ advance/custom-theme' ,
140+ path : 'advance/custom-theme' ,
141141 info : { title : '_d.docs.customTheme' } ,
142142 component : ( ) => (
143143 < Doc
@@ -148,7 +148,7 @@ const routes: Array<RouteDefinition & { kind: Kind }> = [
148148 } ,
149149 {
150150 kind : 'advance' ,
151- path : '/ advance/plugins' ,
151+ path : 'advance/plugins' ,
152152 info : { title : '_d.docs.plugins' } ,
153153 component : ( ) => (
154154 < Doc
@@ -161,6 +161,10 @@ const routes: Array<RouteDefinition & { kind: Kind }> = [
161161
162162// 生成 Drawer 组件的侧边栏菜单
163163export function buildMenus ( l : Locale , prefix : string ) : Array < Menu . MenuItem > {
164+ if ( ! prefix . endsWith ( '/' ) ) {
165+ prefix += '/' ;
166+ }
167+
164168 const menus : Array < Menu . Group > = [
165169 { type : 'group' , label : l . t ( '_d.docs.intro' ) , items : [ ] } ,
166170 { type : 'group' , label : l . t ( '_d.docs.usage' ) , items : [ ] } ,
@@ -265,6 +269,10 @@ function Doc(props: DocProps): JSX.Element {
265269 * 提供了文档浏览的路由定义
266270 */
267271export function buildRoute ( prefix : string , setDrawer : Setter < Drawer . RootRef | undefined > ) : RouteDefinition {
272+ if ( ! prefix . endsWith ( '/' ) ) {
273+ prefix += '/' ;
274+ }
275+
268276 return {
269277 path : prefix ,
270278 component : ( props : ParentProps ) => {
0 commit comments