Vue.config.errorHandler = function(err, vm, info, a) {
Vue.nextTick(() => {
for(let i=0;i < localStorage.length; i++){
let key = localStorage.key(i);
if(new Date().getTime() - new Date(key).getTime() > 2*24*3600*1000) {
localStorage.removeItem(key)
}
}
let date = new Date();
let time = date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds()
let error = {
name: err.name,
message: err.message,
stack: err.stack
}
localStorage.setItem(time, JSON.stringify(error));
})
}