perf[errorLog]:optimized error-log

This commit is contained in:
Pan
2017-12-12 18:14:31 +08:00
parent 85492f148f
commit f9aaaa9091
8 changed files with 118 additions and 74 deletions

View File

@@ -1,14 +1,15 @@
import Vue from 'vue'
import errLog from '@/store/errLog'
import errLog from '@/store/errorLog'
// 生产环境错误日志
if (process.env.NODE_ENV === 'production') {
Vue.config.errorHandler = function(err, vm) {
console.log(err, window.location.href)
errLog.pushLog({
err,
url: window.location.href,
vm
})
}
// you can set only in production env show the error-log
// if (process.env.NODE_ENV === 'production') {
Vue.config.errorHandler = function(err, vm, info) {
errLog.pushLog({
err,
vm,
info,
url: window.location.href
})
console.error(err, info)
}
// }