let _this
= this
window
.onbeforeunload = function (e
) {
if (_this
.$route
.name
== "XXX") {
e
= e
|| window
.event
;
if (e
) {
e
.returnValue
= '关闭提示1111';
}
return '关闭提示222';
} else {
window
.onbeforeunload
= null
}
};
该段代码放在mounted方法里
转载请注明原文地址:https://blackberry.8miu.com/read-38949.html