diff --git a/unitool.js b/unitool.js index a417a3c..2589439 100644 --- a/unitool.js +++ b/unitool.js @@ -218,17 +218,15 @@ export default { // 注意1,resultServer 和 resultCloud 推荐遵循同样的格式 { _state, error | data },这样方便前端做统一判断。 // 注意2,虽然预设了 resultServer 和 resultCloud = {},但如果后台返回了 null,那么 resultServer/resultCloud 也是 null。 if (process.env.NODE_ENV !== 'production') { - console.log( - '%c ' + - JSON.stringify({ startTime: startTime, page: thisRoute, endTime: new Date().toJSON() }) + - ' %c ' + - JSON.stringify({ baseType, apiWho, apiTodo, apiWhat, url }) + - ' %c ' + - JSON.stringify(result), - 'color:blue;background:lightgrey', - 'background:skyblue', - 'background:magenta' - ) // 不知为何,直接用 result 会输出一个奇怪的对象,要主动添加 JSON.stringify 才按照期望输出。 + console.log(`%c[FROM] ${thisRoute}`, 'background: #1e90ff; border-radius: 0.5em;color: white; font-weight: bold; padding: 2px 0.5em;') + console.log(`%c(IN) ${startTime}`, 'background: #87cefa; border-radius: 0.5em;color: white; font-weight: bold; padding: 2px 0.5em;', { + baseType, + apiWho, + apiTodo, + apiWhat, + url, + }) + console.log(`%c(OUT) ${new Date().toJSON()}`, 'background: #4169e1; border-radius: 0.5em;color: white; font-weight: bold; padding: 2px 0.5em;', result) } return result },