How to obtain the parameters passed during jump routing in the umi framework?

First we need to know what routing is?

First of all, we need to know that the umi framework is divided into ordinary routing and conventional routing.
The umi framework itself has routing management, which is in the umirc.ts file.
If ordinary routing does not pass parameters, it directly refers to the history that comes with the umi framework for use.

import {
    
    history} from "umi"
let Login=()=>{
    
    
	history.push("你要进行跳转的路径")
}

Then use the click event directly on the button you want to implement routing jump to trigger this function.
When ordinary routing passes parameters, it obtains the passed parameters.

import {
    
    history} from "umi"
const dian = (i) => {
    
    
        history.push('/Person', i)
    }

At this time, we need to pass the parameters we want to pass through i, and then pass them in the jump routing component.

import {
    
    history} from "umi"
let Shou=props.history.location.state

to receive the passed parameters.
For detailed routing introduction, you can use
the official umi routing document https://v3.umijs.org/zh-CN/docs/convention-routing

Guess you like

Origin blog.csdn.net/qq_53509791/article/details/129871403