umi-手动路由配置

手动路由配置

在配置路由参数的过程中,对应的component文件要写children参数,否则只会匹配一级路由,子路由内容不展示

{
        path: '/test',
        title: 'name',
        component: '@/pages/test/rank/index',
        routes: [
          {
            path: '/test/rank/index',
            title: 'name',
            component: '@/pages/test/rank',
          },
        ]
}
@/pages/test/rank/index文件:
import React from 'react';
const Index = () => {
  return <div>'test-首页'</div>;
};
export default Index;
//此文件中未写children参数,导致匹配子路由test/rank/index时未进行渲染