如何从
获取参数props.location.search
我尝试过的地方
const { propKey, propEid } = new URLSearchParams(props.location.search);
但是propKey
和propEid
在console.log
中未显示
我的网址是这样的:
{{baseurl}} / verify-email?key = a6d16a22a82f16c96ee7d2f95c45c9bc&eid = c2Frc2hpMTFAZ21haWwuY29t
答案 0 :(得分:1)
const params = new URLSearchParams(props.location.search);
const key = params.get('key'); // a6d16a22a82f16c96ee7d2f95c45c9bc&eid=c2Frc2hpMTFAZ21haWwuY29t