• react-router跳转传值


    跳转页面传递参数

    1.引入包 
    import {hashHistory} from ‘React-router’

    2.跳转传值

        handleClick = (value) => {
            hashHistory.push({
                pathname: 'message/detailMessage',
                query: {
                    title:value.title,
                    time:value.time,
                    text:value.text
                },
            })
        }

    3.接收值

    console.info(this.props.location.query.title)
    console.info(this.props.location.query.time)
    console.info(this.props.location.query.text)

     4.如果使用的ant design,可以在model里面获取结果,当然也可以在组件里面获取结果

    组件页面获取结果的写法为:

    import {hashHistory} from 'react-router';
    
    hashHistory.listen(location => {
              //获取传递的数据,对象、值....    
                console.log(location.query);
              // 获取路径
            console.log(location.pathname);
        }
    })
  • 相关阅读:
    C#匿名类型
    C#中实例Singleton
    Unity Pitfall 汇总
    Unity快捷键
    System.Object
    ExecuteInEditMode
    preview放大镜
    判断当前Selection是否为prefab
    AddComponentMenu
    MenuItem属性
  • 原文地址:https://www.cnblogs.com/mabylove/p/7078987.html
Copyright © 2020-2023  润新知