Former-commit-id: 95d5baf9aaedee49ed4f341c165b36d521873c9c [formerly 95d5baf9aaedee49ed4f341c165b36d521873c9c [formerly 95d5baf9aaedee49ed4f341c165b36d521873c9c [formerly 95d5baf9aaedee49ed4f341c165b36d521873c9c [formerly 330406e4cc2346598ee009a18d532b65997bd688 [formerly 1499fb678f01b69954b0729d96e7d39fc2709fc6]]]]]
Former-commit-id: de221d5a7c6b2de8a630830fd2ea015dd79dcbcd
Former-commit-id: 209be7d51ff6103bfd63e3e77094ce2b6d720acd
Former-commit-id: 349fb4dd70e772432afb00aa89eb15bad514ce72 [formerly fc2b30471c827b14605252706fd8a1b58a847947]
Former-commit-id: e09b5544a3d3f7093b812d86a96be36938cc4ddb
Former-commit-id: fceb4888d7e32350a6e85cc78e28b2e273027fed
Former-commit-id: 69b0978005a32b472a421c2ce9462f8549405183
Former-commit-id: b2b88707f315ab0b9ec17d1747a86e9d0c72fc38
Former-commit-id: 418f35d509ee5e159a20a98f81e423aecca388d0
This commit is contained in:
liyang 2018-08-09 01:29:41 +08:00
parent dd6bcfd94b
commit 84da66a5ab
4 changed files with 10 additions and 2 deletions

View File

@ -30,6 +30,7 @@
"lodash.get": "^4.4.2",
"lodash.set": "^4.3.2",
"lodash.sortby": "^4.7.0",
"lodash.tostring": "^4.1.4",
"lodash.uniqueid": "^4.0.1",
"lowdb": "^1.0.0",
"marked": "^0.3.9",

View File

@ -5,6 +5,7 @@ export default {
install (Vue, options) {
Vue.config.errorHandler = function (err, vm, info) {
Vue.nextTick(() => {
// 添加 log
store.dispatch('d2admin/log/add', {
type: 'error',
err,

View File

@ -6,11 +6,16 @@ export default {
// 快速打印 log
Vue.prototype.$log = util.log
// 快速记录日志
Vue.prototype.$logAdd = function (info) {
Vue.prototype.$logAdd = function (info, show = true) {
// store 赋值
store.dispatch('d2admin/log/add', {
type: 'log',
info
})
// 显示在控制台
if (show && process.env.NODE_ENV === 'development') {
console.log(info)
}
}
}
}

View File

@ -1,5 +1,6 @@
import dayjs from 'dayjs'
import get from 'lodash.get'
import toString from 'lodash.tostring'
import util from '@/libs/util.js'
export default {
@ -68,7 +69,7 @@ export default {
type,
err,
vm,
info
info: toString(info)
}))
}
}