提交 cc2e35bd 编写于 作者: fxy060608's avatar fxy060608

feat(cli): improve log (debug mode)

上级 3f7a430e
...@@ -3,10 +3,17 @@ function typof (v) { ...@@ -3,10 +3,17 @@ function typof (v) {
return s.substring(8, s.length - 1) return s.substring(8, s.length - 1)
} }
function isDebugMode () {
return typeof name === 'string' && name === 'uni-app'
}
export default function formatLog () { export default function formatLog () {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key] args[_key] = arguments[_key]
} }
if (isDebugMode()) {
return args
}
var msgs = args.map(function (v) { var msgs = args.map(function (v) {
var type = Object.prototype.toString.call(v) var type = Object.prototype.toString.call(v)
......
...@@ -180,8 +180,9 @@ export function registerApp (appVm) { ...@@ -180,8 +180,9 @@ export function registerApp (appVm) {
if (process.env.NODE_ENV !== 'production') { if (process.env.NODE_ENV !== 'production') {
console.log(`[uni-app] registerApp`) console.log(`[uni-app] registerApp`)
} }
appCtx = appVm appCtx = appVm
appCtx.$vm = appVm
Object.assign(appCtx, defaultApp) // 拷贝默认实现 Object.assign(appCtx, defaultApp) // 拷贝默认实现
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册