如何将提取的用户 ID 放入 mern 堆栈中的文本字段中
How to put the extracted user ID in the textfield in mern stack
- 我正在使用 MERN Stack 构建网站。我在 url
http://localhost:3000/5f539fbf8e7b1c16806a863f%20/new_appointment
上有此数据,其中 5f539fbf8e7b1c16806a863f
是唯一 ID。我想 return 标签或文本字段中的那个 ID。
已解决
使用 this.props.match.params.id
有很多方法可以得到它,但我更喜欢这种方式。
const url ="http://localhost:3000/5f539fbf8e7b1c16806a863f%20/new_appointment"
const idMix = url.split("/")[3]
const id = idMix.split("%")[0]
希望它能解决您的疑问。
- 我正在使用 MERN Stack 构建网站。我在 url
http://localhost:3000/5f539fbf8e7b1c16806a863f%20/new_appointment
上有此数据,其中5f539fbf8e7b1c16806a863f
是唯一 ID。我想 return 标签或文本字段中的那个 ID。
已解决
使用 this.props.match.params.id
有很多方法可以得到它,但我更喜欢这种方式。
const url ="http://localhost:3000/5f539fbf8e7b1c16806a863f%20/new_appointment"
const idMix = url.split("/")[3]
const id = idMix.split("%")[0]
希望它能解决您的疑问。