no message

Former-commit-id: 9050b9d382144bfe3ab53b012be11461e0332aba
Former-commit-id: 945e9c09f433ee70768ae89a742df931dca1748f
Former-commit-id: 2dc0ede52e025f6ad6be58135a579ccda3ab93ad
This commit is contained in:
李杨
2018-01-25 23:47:19 +08:00
parent 4bcc6e7396
commit 5e830d81e7
4 changed files with 22 additions and 14 deletions

View File

@@ -29,11 +29,12 @@ import '@/mock/index.js'
// vuex
import store from '@/store/index.js'
import d2Admin from '@/plugin/d2Admin'
// log简化
import pluginLog from '@/plugin/log'
Vue.use(ElementUI)
Vue.use(d2Admin)
Vue.use(pluginLog)
Vue.config.productionTip = false

View File

@@ -75,9 +75,7 @@ export default {
}
})
.then (res => {
console.group('登录')
console.log(res)
console.groupEnd()
this.$log('登录结果', res)
})
} else {
return false

View File

@@ -1,9 +0,0 @@
export default {
install (Vue, options) {
Vue.mixin({
created () {
console.log('hahaha')
}
})
}
}

18
src/plugin/log/index.js Normal file
View File

@@ -0,0 +1,18 @@
export default {
install (Vue, options) {
// 打印log
// 如果只有一个参数 就只简单打印第一个参数
// 如果有大于一个参数 第一个参数会当做是分组的名称
Vue.prototype.$log = (arg1 = 'log', ...logs) => {
if (logs.length === 0) {
console.log(arg1)
} else {
console.group(arg1)
logs.forEach(e => {
console.log(e)
})
console.groupEnd()
}
}
}
}