怎样实现判断当前页面是否修改内容,并在离开页面的时候给出提示?
let _this=this;
window.onbeforeunload = function() {
let nowOrderVo=JSON.stringify(_this.orderVo);
if (_this.copyOrderVo!==nowOrderVo) {
try {
return "当前修改尚未保存,是否离开?";
} catch (err) {}
}
};