react-router4 Prompt实现路由跳转前的提示 Prompt组件是react-router4 提供的组件,主要作用于路由跳转前的阻止、提示等操作,常使用于提示用户未保存等提示。 when 当Prompt的when属性为true时,渲染Prompt该组件。 message 阻止时的提示框的文字内容(string),也可以使用函数形式的属性值,动态返回message值,也可以通过函数形式实现自定义提示组件 博客地址 https://juejin.im/post/5d90864df265da5b7f1c8db4