# antComponents **Repository Path**: hp1544/antComponents ## Basic Information - **Project Name**: antComponents - **Description**: ant组件实例 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-12-09 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## router 4.0 1. react-router为base包。浏览器端用react-router-dom 2. HashRouter、BrowserRouter * HashRouter:http://localhost:3000/#/home * BrowserRouter:http://localhost:3000/home 3. switch 路由只会匹配switch标签中想匹配的第一个页面,不会再向下匹配。 4. Route:path、exact、component、reder 1. path:对应页面路径 2. exact:router4.0支持一个路径对应多个组件,exact来设置是否匹配多个 例如 如果没有加exact参数,输入/home/a 会加载 b、a两个组件。 3. render方法,如果route标签中有render方法,则路由不会去匹配component中的组件,而是取render方法返回的组件 4. ①参数传递: url输入/home/1/hp 就会匹配到b组件,并且props.match.params = {id:1,name:hp}. 路径必须输全才会匹配 ②. 也可以使用?拼接形式 可以从props.location.search 获取?之后的字符,最后再做下转换。