如何使用 react-router 从哈希 URL 获取参数? [英] How to get parameters from hash URL with react-router?
本文介绍了如何使用 react-router 从哈希 URL 获取参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用 react-router 从 HASH URL 获取 URL 参数的任何方法.
Any method to get URL parameters from a HASH URL with react-router.
推荐答案
您应该能够通过 this.props.location访问
组件中的位置code> 并将其传递给子组件,如 v2.0.0 升级指南所述:https://github.com/ReactTraining/react-router/blob/v2.8.1/upgrade-guides/v2.0.0.md#accessing-location
You should be able to access the location in your <Route>
Component via this.props.location
and pass it down to child components as described in the v2.0.0 Upgrade Guide: https://github.com/ReactTraining/react-router/blob/v2.8.1/upgrade-guides/v2.0.0.md#accessing-location
位置文档:
https://github.com/ReactTraining/react-router/blob/v2.8.1/docs/Glossary.md#location
这篇关于如何使用 react-router 从哈希 URL 获取参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文