You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
411 B

2 years ago
  1. import { useSearchParams } from 'react-router-dom'
  2. function About () {
  3. const [params] = useSearchParams()
  4. /**
  5. * params 是一个对象对象里有一个 get 的方法用来获取对应的参数把参数的名称作为 get 方法的实参传过来
  6. */
  7. const id = params.get('id')
  8. return (
  9. <div>About得到的参数 id 值为 {id}</div>
  10. )
  11. }
  12. export default About