更新记录

1.0.0(2026-05-19) 下载此版本

1.0.0版本创建


平台兼容性

uni-app(5.06)

Vue2 Vue3 Chrome Safari app-vue app-nvue Android iOS 鸿蒙
× × 10.0 12 ×
微信小程序 支付宝小程序 抖音小程序 百度小程序 快手小程序 京东小程序 鸿蒙元服务 QQ小程序 飞书小程序 小红书小程序 快应用-华为 快应用-联盟
× × × × × × × × × × × ×

uni-app x(5.06)

Chrome Safari Android iOS 鸿蒙 微信小程序
× × 10.0 12 × ×

其他

多语言 暗黑模式 宽屏模式
× ×

🛠 EConsole

uni-app App 端轻量级调试工具,类似 vConsole。

在 App 真机上直接显示一个原生悬浮调试面板,实时查看 console 日志、网络请求和 storage 数据。

功能

  • 🔍 自动拦截 console.log / info / warn / error,支持按级别筛选
  • 🌐 自动拦截 uni.request / uploadFile / downloadFile,展示请求详情
  • 💾 一键查看当前所有 Storage 数据快照
  • 🟢 原生悬浮按钮,可拖拽移动
  • 📋 原生 WebView 面板,跨页面常驻,不影响原页面布局
  • 🗑 提供 destroyNativePanel() 完全销毁释放资源

使用方式

1. 引入插件

main.ts 中引入拦截器和原生面板:

import { initEConsole } from '@/uni_modules/econsole/addInterceptor'
import { initNativePanel } from '@/uni_modules/econsole'

2. 初始化

createApp 中调用,建议仅开发环境启用:

export function createApp() {
  const app = createSSRApp(App)

  // #ifdef APP-PLUS
  const { html } = initEConsole({ app })
  initNativePanel({ html })
  // #endif

  return { app }
}

启动后,屏幕右下角出现绿色 EC 按钮,点击即可打开调试面板。

3. 销毁(可选)

import { destroyNativePanel } from '@/uni_modules/econsole'

destroyNativePanel()

示例

// 基础用法 — 默认配置
const { html } = initEConsole({ app })
initNativePanel({ html })

// 自定义面板高度和按钮位置
const { html } = initEConsole({ app, maxLogs: 1000, maxRequests: 500 })
initNativePanel({ html, heightPercent: 60, buttonBottom: 300, buttonRight: 30 })

// 手动控制面板显隐
import { showNativePanel, hideNativePanel } from '@/uni_modules/econsole'
showNativePanel()
hideNativePanel()

配置参数

initEConsole(options)

参数 类型 默认值 说明
app App 实例 - Vue app 实例,用于捕获框架级错误
maxLogs number 500 最大日志条数
maxRequests number 200 最大请求条数

initNativePanel(options)

参数 类型 默认值 说明
html string - 面板 HTML(由 initEConsole 返回)
heightPercent number 70 面板高度占屏幕百分比
buttonBottom number 200 悬浮按钮距底部距离(dp)
buttonRight number 20 悬浮按钮距右侧距离(dp)

注意事项

Console 拦截依赖 uni.__log__(uni-app 编译产物),不存在时 fallback 到 console[level] 覆盖。

Network 使用 uni.addInterceptor,与项目中其他拦截器不冲突。

Storage 为快照模式,打开面板时读取,非实时监听。

生产环境请通过条件编译排除,避免调试代码打入正式包。

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

插件不采集任何数据

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

MIT协议

暂无用户评论。