Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.0k views
in Technique[技术] by (71.8m points)

有什么办法让开发者能够在移动端看到项目的报错信息(不在界面上打印出来)?

用Nuxt.js开发了一个移动端项目,上线后用户反馈某个页面报错,然而本地用尽办法却无法复现这个bug,请问有什么办法可以在移动端将报错信息以某种形式让开发者能看见但又不影响用户体验?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

可以试试这个vConsole

中文文档

vConsole是一款由微信公众平台前端团队打造的前端调试面板,专治手机端看log难题。
  • 下载vconsole最新版本或者直接用npm下载nom install vconsole

引入vconsole到项目中:

<script src="path/to/vconsole.min.js"></script>
<script>
// init vConsole
var vConsole = new VConsole();
console.log('Hello world');
</script>

或者通过import 初试化:

import VConsole from 'vconsole/dist/vconsole.min.js' //import vconsole
let vConsole = new VConsole() // 初始化

项目运行,点击页面右下角vconsole图标,即可看到debug内容
如果想要查看接口调用情况,和浏览器一样直接点击network按钮即可


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...