window.onbeforeunload = function(e) {
var dialogText = 'cancel?';
e.returnValue = dialogText;
return dialogText;
}
放到componentWillMount中即可
window.onbeforeunload = function(e) {
var dialogText = 'cancel?';
e.returnValue = dialogText;
return dialogText;
}
放到componentWillMount中即可
本文标题:react 阻止浏览器刷新
本文链接:https://www.haomeiwen.com/subject/xntaxltx.html
网友评论