umi页面间跳转路由

668 阅读1分钟

作为一个刚工作一个月的小白,在使用umi时路由方面搞了个问题出来:那就是Link跳转到指定页面时是空白页面,并且不报错 对于config/config.js中我各种配置始终得不到解决,直到去了解了umi路由原理,umi的约定路由会在pages文件夹下自动生成路由配置,例如pages/user,会生成路由:{path:'/user',component:'./user'}也就是说path和component是有关联的,所以写成link to='/planMana/planOverView/addMes',然后再config/config.js中配置为{path:'/planMana/planOverView/addMes',component:'./AddPlanNode'}就会发生跳转到了空页面的情况

```<Link to="/addPlanNode">

            <Button className={styles['overView-addmes']}>+ 添加数据</Button>

   </Link>
   config/config.js文件下
   {

      path : '/addPlanNode',

      component : './AddPlanNode',

    },