默认展开的是“应用使能平台”页面,radio选择表格中的某一行,id作为参数,需要传递给企业信息的页面。在topic这个组件中,无法通过callback的形式进行参数传递,要如何实现两个子页面之间数据的传递???
默认展开的是“应用使能平台”页面,radio选择表格中的某一行,id作为参数,需要传递给企业信息的页面。在topic这个组件中,无法通过callback的形式进行参数传递,要如何实现两个子页面之间数据的传递???
//parent
onClick={()=>(this.props.history.push(`/topic`,{selectedId: selectedId}))}
//component
class Index extends Component {
constructor(props) {
super(props);
const { state } = this.props.location;
let id;
if (state) {
if (state.id) {
id = state.id;
}
}
this.state = {selectedId: id}
}
不知道这样能不能满足你的需求
10 回答11.1k 阅读
6 回答3k 阅读
5 回答4.8k 阅读✓ 已解决
4 回答3.1k 阅读✓ 已解决
2 回答2.7k 阅读✓ 已解决
3 回答1.9k 阅读✓ 已解决
3 回答2.3k 阅读✓ 已解决
笨办法,单击
radio
时,把id
放到state
中。然后在topic页面获取这个state
就可以了。router可以这样传呀。