This commit is contained in:
陆柯 2023-01-31 10:41:54 +08:00
parent 7995861193
commit 5b3008b601

View File

@ -218,17 +218,15 @@ export default {
// 注意1resultServer 和 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
},