http://localhost:3000/5f539fbf8e7b1c16806a863f%20/new_appointment
上有此数据,其中5f539fbf8e7b1c16806a863f
是唯一的ID。我想在标签或文本字段中返回该ID。 已解决
已使用this.props.match.params.id
答案 0 :(得分:0)
有很多方法可以做到这一点,但我更喜欢这种方式。
const url ="http://localhost:3000/5f539fbf8e7b1c16806a863f%20/new_appointment"
const idMix = url.split("/")[3]
const id = idMix.split("%")[0]
我希望它能解决您的问题。