当前位置: 首页 > news >正文

诊所网站模板嘉兴seo排名外包

诊所网站模板,嘉兴seo排名外包,商河网站建设公司,哪些网站可以做微商品牌宣传console.log封装 在控制台中打印带有颜色和格式的日志信息。 /*** 检查给定的对象是否为数组*/ const isArray function (obj: any): boolean {return Object.prototype.toString.call(obj) [object Array] }/*** Logger 构造函数*/ Logger () > {}/*** 根据日志类型返回…

console.log封装

在控制台中打印带有颜色和格式的日志信息。

/*** 检查给定的对象是否为数组*/
const isArray = function (obj: any): boolean {return Object.prototype.toString.call(obj) === '[object Array]'
}/*** Logger 构造函数*/
Logger = () => {}/*** 根据日志类型返回对应的颜色*/
Logger.typeColor = function (type: string) {let color = ''switch (type) {case 'primary':color = '#2d8cf0'breakcase 'success':color = '#19be6b'breakcase 'info':color = '#909399'breakcase 'warn':color = '#ff9900'breakcase 'error':color = '#f03f14'breakdefault:color = '#35495E'break}return color
}/*** 打印日志信息,可选择是否带有背景色*/
Logger.print = function (type = 'default', text: any, back = false) {if (typeof text === 'object') {// 如果是對象則調用打印對象方式isArray(text) ? console.table(text) : console.dir(text)return}if (back) {// 如果是打印帶背景圖的console.log(`%c ${text} `,`background:${Logger.typeColor(type)}; padding: 2px; border-radius: 4px; color: #fff;`)} else {console.log(`%c ${text} `,`border: 1px solid ${Logger.typeColor(type)};padding: 2px; border-radius: 4px;color: ${Logger.typeColor(type)};`)}
}/*** 打印带有背景色的日志信息*/
Logger.printBack = function (type = 'primary', text) {this.print(type, text, true)
}/*** 打印格式化的日志信息,可选择是否带有背景色*/
Logger.pretty = function (type = 'primary', title, text) {if (typeof text === 'object') {console.group('Console Group', title)console.log(`%c ${title}`,`background:${Logger.typeColor(type)};border:1px solid ${Logger.typeColor(type)};padding: 1px; border-radius: 4px 0 0 4px; color: #fff;`)isArray(text) ? console.table(text) : console.dir(text)console.groupEnd()return}console.log(`%c ${title} %c ${text} %c`,`background:${Logger.typeColor(type)};border:1px solid ${Logger.typeColor(type)};padding: 1px; border-radius: 4px 0 0 4px; color: #fff;`,`border:1px solid ${Logger.typeColor(type)};padding: 1px; border-radius: 0 4px 4px 0; color: ${Logger.typeColor(type)};`,'background:transparent')
}/*** 使用 primary 类型打印格式化的日志信息*/
Logger.prettyPrimary = function (title, ...text) {text.forEach((t) => this.pretty('primary', title, t))
}/*** 使用 success 类型打印格式化的日志信息*/
Logger.prettySuccess = function (title, ...text) {text.forEach((t) => this.pretty('success', title, t))
}/*** 使用 warn 类型打印格式化的日志信息*/
Logger.prettyWarn = function (title, ...text) {text.forEach((t) => this.pretty('warn', title, t))
}/*** 使用 error 类型打印格式化的日志信息*/
Logger.prettyError = function (title, ...text) {text.forEach((t) => this.pretty('error', title, t))
}/*** 使用 info 类型打印格式化的日志信息*/
Logger.prettyInfo = function (title, ...text) {text.forEach((t) => this.pretty('info', title, t))
}export default Logger
http://www.dinnco.com/news/57149.html

相关文章:

  • 网站建设项目详情铜川网站seo
  • 上海做核酸最新通知yoast seo
  • 网站建设素材库家电企业网站推广方案
  • 网站很久没被收录的新闻怎么处理如何做网站搜索引擎优化
  • 市场部做网站工作职责阿里云建站费用
  • 做网站免费的app是什么百度收录怎么弄
  • 网站建设的重点难点seo平台是什么
  • 商城网站建设明细广州网站优化价格
  • 哪个网站有适合小学生做的题目手游cpa推广平台
  • 免费域名网站建设旺道网站排名优化
  • 网站建设总体流程英语seo
  • 网页制作素材可爱图片信息流优化师简历怎么写
  • jsp web网站开发网站流量指标有哪些
  • 我找伟宏篷布我做的事ko家的网站做百度推广代运营有用吗
  • 温州外贸公司网站建设公司排名想学管理方面的培训班
  • 手机网站seo优化百度竞价点击神器
  • 保定关键词优化排名免费网站分析seo报告是坑吗
  • 网站建站开发做网上营销怎样推广
  • 淄博市住房和城乡建设局官方网站竞价账户托管的公司有哪些
  • 茶叶网站模板 html关键词自助优化
  • 一流的网站建设磁力bt种子搜索
  • 网站建设优秀网百度推广账户怎么开
  • adobe xd可以做网站吗南宁网站优化公司电话
  • 保险网站建设sem搜索
  • 怎么邀约客户做网站淘宝运营
  • 广东省公路建设公司官方网站非企户百度推广
  • 设计的网站有哪些深圳推广不动产可视化查询
  • 如何做网站首页图合肥百度关键词推广
  • 无锡网站商城建设磁力多多
  • 网站建设规划360seo