From ad27f7ca20b3bf055821cf09aae6fcf9fd84a252 Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Thu, 2 Apr 2020 23:20:44 +0800 Subject: [PATCH] no message --- packages/vue-cli-plugin-uni/lib/format-log.js | 11 +++++++++-- packages/vue-cli-plugin-uni/lib/h5/index.js | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/vue-cli-plugin-uni/lib/format-log.js b/packages/vue-cli-plugin-uni/lib/format-log.js index fb6017e8e9..f7e9dcffc6 100644 --- a/packages/vue-cli-plugin-uni/lib/format-log.js +++ b/packages/vue-cli-plugin-uni/lib/format-log.js @@ -3,17 +3,24 @@ function typof (v) { return s.substring(8, s.length - 1) } -function isDebugMode () { +function isDebugMode () { /* eslint-disable no-undef */ return typeof __channelId__ === 'string' && __channelId__ } +export function log (type) { + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key] + } + console[type].apply(console, args) +} + export default function formatLog () { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key] } var type = args.shift() - if (isDebugMode()) { + if (isDebugMode()) { args.push(args.pop().replace('at ', 'uni-app:///')) return console[type]['apply'](console, args) } diff --git a/packages/vue-cli-plugin-uni/lib/h5/index.js b/packages/vue-cli-plugin-uni/lib/h5/index.js index 10e4e8b2ad..2f37600dae 100644 --- a/packages/vue-cli-plugin-uni/lib/h5/index.js +++ b/packages/vue-cli-plugin-uni/lib/h5/index.js @@ -34,7 +34,7 @@ const uniCloudPath = path.resolve(__dirname, '../../packages/uni-cloud/dist/inde function getProvides () { return { - '__f__': [path.resolve(__dirname, '../format-log.js'), 'default'], + '__f__': [path.resolve(__dirname, '../format-log.js'), 'log'], 'uniCloud': [uniCloudPath, 'default'], 'wx.nextTick': [runtimePath, 'nextTick'], 'Page': [runtimePath, 'Page'], -- GitLab