美文网首页
dva 路由跳转

dva 路由跳转

作者: LenHong | 来源:发表于2019-06-17 17:25 被阅读0次
    1. 利用 routerRedux 进行路由跳转
    /**
      pathname: 路由路径
      search: 路由跳转时携带的参数,路由跳转后可以通过 this.props.location.search 获取传递的参数
    **/
    this.props.dispatch(
      routerRedux.push({ pathname, search })
    );
    
    1. 基于 dva/router 进行跳转
    import { Link } from 'dva/router'
    
    <Link to='/maintain/eventstatisticsdetial'>查看</Link>
    
    //带参数跳转, 跳转后页面通过 this.props.location.query获取参数
    <Link to='/maintain/eventstatisticsdetial?a=b&id=123'>查看</Link>
    
    //带参数跳转, 跳转后页面通过 this.props.location.state 获取参数
    <Link to={ pathname,state }>查看</Link>
    
    1. 基于 umi/link,通常作为 React 组件使用。
    import Link from 'umi/link';
    
    export default () => (
      <Link to="/list">Go to list page</Link>
    );
    
    1. 基于 umi/router,通常在事件处理中被调用。
    import router from 'umi/router';
    
    function goToListPage() {
      router.push('/list');
    }
    

    ant design Pro 扩展路由配置路由配置说明

    {
      name: 'home',
      icon: 'home', // 当前路由在菜单下的图标名
      hideInMenu: true, // 当前路由在菜单中不展现,默认 false
      hideChildrenInMenu: true, // 当前路由的子级在菜单中不展现,默认 false。
      hideInBreadcrumb: true, // 在面包屑中隐藏当前路由,默认 false。
      authority: ['user'], // 展示的权限,默认都可见
    }
    

    相关文章

      网友评论

          本文标题:dva 路由跳转

          本文链接:https://www.haomeiwen.com/subject/wqgafctx.html