react-router-dom 参数不包含 URL 中出现的问号

react-router-dom params doesn't include question marks which are present in URL

react-router-dom 参数不包含 URL.

中出现的问号

假设 URL 参数是这样的:'/I-am-John-Doe-Who-Are-You?' 但是当我 console.log 'react-router-dom' params 时,它记录的只是 'I-am-John-Doe-Who-Are-You',而不是 ? URL.

末尾的问号

当URL参数中包含两个问号时,如'/I-am-John-Doe?-Who-Are-你呢?' 然后它只会提取参数直到第一个问号(问号仍然不包括在内),如 'I-am-John-Doe'

我想将这些参数发送到我服务器的 Rest API 但这现在给我带来了问题。

url中的

?表示可选参数, 所以当你看到 url 之类的 URL?something=ppp

表示参数something = ppp

所以你不能包括 ?