NextJS 使用 querystring
文章目录

需要使用 Router: https://nextjs.org/docs/api-reference/next/router#router-object

router object

  • pathname: String - Current route. That is the path of the page in /pages
  • query: Object - The query string parsed to an object. Defaults to {}
  • asPath: String - Actual path (including the query) shown in the browser
1
2
3
4
5
6
7
8
9
10
11
12
13
import {useRouter} from 'next/router'


const Login: React.FC<{}> = () => {
const {query} = useRouter()

useEffect(() => {
console.log(isWechatLoginCallback);
}, [isWechatLoginCallback])

}

export default Login