第一步:给你的Chrome
添加JetBrains IDE Support
的插件,需要FQ,就是下图的这个。
![](https://img.php1.cn/3cd4a/1eebe/cd5/ddcc574beb16294e.jpeg)
添加一个Javascript Debug
![](https://img8.php1.cn/3cdc5/1895d/9f3/aa502a87150f36b0.png)
name可以自定义,URL根据自己实际情况,(我这边没有在下面的Before launch:Show this page,Activate tool window
这一栏里添加这个项目npm start
或者yarn start
的启动脚本,一定要先启动项目,然后在点虫子按钮)
Before launch:Show this page,Activate tool window
这一栏里添加这个项目npm start
或者yarn start
的启动脚本,一定要先启动项目,然后在点虫子按钮)
![](https://img8.php1.cn/3cdc5/1895d/9f3/082df88b35cde4ea.png)
需要设置的话,配置如下,具体命令和package.json根据实际情况配置
![](https://img8.php1.cn/3cdc5/1895d/9f3/7a231dce95bb3b4a.png)
![](https://img8.php1.cn/3cdc5/1895d/9f3/b95145332dc38f35.png)
浏览器的配置,点击后就后开启监控
![](https://img8.php1.cn/3cdc5/1895d/9f3/5e32b52cd1a8d8a2.png)
点小虫虫开始debug,谷歌浏览器会弹出一个独立的浏览器页面用于调试
![](https://img8.php1.cn/3cdc5/1895d/9f3/53b90566af7d2dd5.png)
重点来了,有时候你在编辑器的代码可能断点不了,可以用console.log()打印,然后在浏览器点进源码进行断点,触发时会自动联动到编辑器
![](https://img8.php1.cn/3cdc5/1895d/9f3/227ead452a421cf6.png)
![](https://img8.php1.cn/3cdc5/1895d/9f3/f7a3cebb9780a3ac.png)