diff --git a/src/plugin/log/index.js b/src/plugin/log/index.js index 46f581fe..2be75be1 100644 --- a/src/plugin/log/index.js +++ b/src/plugin/log/index.js @@ -4,11 +4,11 @@ import util from '@/libs/util' export default { install (Vue, options) { // 快速打印 log - Vue.prototype.$log = util.log - // 快速记录日志 - Vue.prototype.$logAdd = function (data) { - // store 赋值 - store.dispatch('d2admin/log/add', data) + Vue.prototype.$log = { + ...util.log, + push (data) { + store.dispatch('d2admin/log/add', data) + } } } } diff --git a/src/views/demo/playground/log/log/index.vue b/src/views/demo/playground/log/log/index.vue index 4153d5dd..614e9f18 100644 --- a/src/views/demo/playground/log/log/index.vue +++ b/src/views/demo/playground/log/log/index.vue @@ -21,7 +21,7 @@ export default { }, methods: { handleAdd () { - this.$logAdd({ + this.$log.push({ message: this.text }) }