D2Admin 1.7
Former-commit-id: 3010ce31114fdc121006451c72f9e18306239fd2
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import store from '@/store'
|
||||
import util from '@/libs/util'
|
||||
|
||||
export default {
|
||||
install (Vue, options) {
|
||||
// 快速打印 log
|
||||
Vue.prototype.$log = {
|
||||
...util.log,
|
||||
push (data) {
|
||||
if (typeof data === 'string') {
|
||||
// 如果传递来的数据是字符串
|
||||
// 赋值给 message 字段
|
||||
// 为了方便使用
|
||||
// eg: this.$log.push('foo text')
|
||||
store.dispatch('d2admin/log/push', {
|
||||
message: data
|
||||
})
|
||||
} else if (typeof data === 'object') {
|
||||
// 如果传递来的数据是对象
|
||||
store.dispatch('d2admin/log/push', data)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user