安装umi
- npm/yarn create @ umijs/umi-app
安装依赖
- npm/yarn install
运行
- npm run start
打包
- npm run build
Umi3==>推荐使用yarn
路由
路由组件可通过 props 获取到以下属性,
match,当前路由和 url match 后的对象,包含 params、path、url 和 isExact 属性;
location,表示应用当前出于哪个位置,包含 pathname、search、query 等属性;
history,同api#history 接口 ;
route,当前路由配置,包含 path、exact、component、routes 等;
routes,全部路由信息
传递参数给子路由
通过 cloneElement,一次就好(Umi 2 时需要两次)。
import React from 'react';
export default function Layout(props) {
return React.Children.map(props.children, child => {
return React.cloneElement(child, { foo: 'bar' });
});
}
编译提速
nodeModulesTransform{type:‘none’}
https://www.cnblogs.com/mq0036/p/7453380.html#_label0_0
Bootstrap组件福利篇:十二款好用的组件推荐