1.0.0 • Published 4 years ago
monitor-tool v1.0.0
前端监控工具
监控范围
- js 运行时错误
- 资源加载错误 css/js/img
- promise 未 catch 的错误
- vue 项目全局错误
使用
引入资源
- script
- npm install monitor-cli
初始化
import { createApp } from 'vue';
import App from '@/App';
// 引入
import 'monitor-cli';
// 初始化 monitor
window.monitor = new Monitor({ url, module });
const app = createApp(App).use(minitor.vueMonitorPlugin);
// 手动上报错误 error/warn/info
monitor.error({});
// 注册了vueMonitorPlugin, 在vue中
this.$throw({});