From 5bbb4abe212d78a25b8d7b29999f96b8b3f87284 Mon Sep 17 00:00:00 2001 From: Pan Date: Wed, 29 Aug 2018 11:12:15 +0800 Subject: [PATCH] chore: in dev disable errorLog --- src/errorLog.js | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/errorLog.js b/src/errorLog.js index 7f7e492e..00b18b72 100644 --- a/src/errorLog.js +++ b/src/errorLog.js @@ -2,20 +2,18 @@ import Vue from 'vue' import store from './store' // you can set only in production env show the error-log -// if (process.env.NODE_ENV === 'production') { - -Vue.config.errorHandler = function(err, vm, info, a) { +if (process.env.NODE_ENV === 'production') { + Vue.config.errorHandler = function(err, vm, info, a) { // Don't ask me why I use Vue.nextTick, it just a hack. // detail see https://forum.vuejs.org/t/dispatch-in-vue-config-errorhandler-has-some-problem/23500 - Vue.nextTick(() => { - store.dispatch('addErrorLog', { - err, - vm, - info, - url: window.location.href + Vue.nextTick(() => { + store.dispatch('addErrorLog', { + err, + vm, + info, + url: window.location.href + }) + console.error(err, info) }) - console.error(err, info) - }) + } } - -// }