参考:https://lequ7.com/2019/01/16/javascript/React-zu-jian-xie-zai-lu-you-tiao-zhuan-ye-mian-guan-bi-shua-xin-zhi-qian-jin-xing-ti-shi/

import {Prompt} from ‘react-router-dom’;
const Editor=()=>{
return (
    <div>
        <Prompt
            //  when相当于disabled,为true时,当react路由跳转就会触发
            when={true}
            message={location => ‘文章要保存吼,确定离开吗?’}
        />
    </div>
   )
}        

 

相关文章:

  • 2022-12-23
  • 2021-12-06
  • 2021-06-02
  • 2022-12-23
  • 2021-12-13
  • 2022-12-23
  • 2022-12-23
  • 2021-10-05
猜你喜欢
  • 2022-12-23
  • 2021-10-30
  • 2022-12-23
  • 2022-12-23
  • 2021-10-19
  • 2021-04-09
  • 2022-12-23
相关资源
相似解决方案