ts
const Logs = {
/**
* 成功
* @param val
* @param title
*/
success(val: any, title?: string) {
console.log(`%c ${title || 'success'}: `, 'color: #67C23A; font-weight: bold', val);
},
/**
* 失败
* @param val
* @param title
*/
error(val: any, title?: string) {
console.log(`%c ${title || 'error'}: `, 'color: #F56C6C; font-weight: bold', val);
},
/**
* 警告
* @param val
* @param title
*/
warn(val: any, title?: string) {
console.log(`%c ${title || 'warn'}: `, 'color: #E6A23C; font-weight: bold', val);
},
/**
* 信息
* @param val
* @param title
*/
info(val: any, title?: string) {
console.log(`%c ${title || 'info'}: `, 'color: #909399; font-weight: bold', val);
}
};
export default Logs;
js
const Logs = {
/**
* 成功
* @param val
* @param title
*/
success(val, title) {
console.log(`%c ${title || 'success'}: `, 'color: #67C23A; font-weight: bold', val);
},
/**
* 失败
* @param val
* @param title
*/
error(val, title) {
console.log(`%c ${title || 'error'}: `, 'color: #F56C6C; font-weight: bold', val);
},
/**
* 警告
* @param val
* @param title
*/
warn(val, title) {
console.log(`%c ${title || 'warn'}: `, 'color: #E6A23C; font-weight: bold', val);
},
/**
* 信息
* @param val
* @param title
*/
info(val, title) {
console.log(`%c ${title || 'info'}: `, 'color: #909399; font-weight: bold', val);
}
};
export default Logs;
🎯 拓展阅读提示
本文涉及的内容已同步至公众号后台,我会在那里分享更多深度内容和实用技巧
→ 点击关注:一行梦境
文章评论