两个页面切换,如何禁止刷新呢?不借助浏览器缓存方法,比如localStorage、sessionStorage, 切换会重新刷新页面,想要的结果是第一次切换刷新后,再次切换到当前页面无需刷新,就跟antd的Tabs一样效果 比如下面两个页面,用Radio来互相切换,比如第一个ChildComponents_1页面input输入“测试”内容,切换到ChildComponents_2,再切换ChildComponents_1,发现input输入“测试”内容已经没了,页面被重新初始化了,这个不通过浏览器缓存方法该怎么解决呢? import React from 'react'; import {Radio,Input} from 'antd'; import ChildComponents_2 from './ChildComponents_2'; class ChildComponents_1 extends React.Component { constructor(props) { super(props); this.state = { inputValue:'', radioValue:'组件一' } } render() { const {inputValue,radioValue} = this.state; return ( { radioValue==='组件一'?( { this.setState({inputValue:e.target.value}); }} /> { this.setState({radioValue:e.target.value}); }} > 组件一 组件二 ):( ) } ); } } export default ChildComponents_1; import React from 'react'; import {Radio,Input} from 'antd'; import ChildComponents_1 from './ChildComponents_1'; class ChildComponents_2 extends React.Component { constructor(props) { super(props); this.state = { inputValue:'', radioValue:'组件二' } } render() { const {inputValue,radioValue} = this.state; return ( { radioValue==='组件二'?( { this.setState({inputValue:e.target.value}); }} /> { this.setState({radioValue:e.target.value}); }} > 组件一 组件二 ):( ) } ); } } export default ChildComponents_2;