使用browser-sync模块进行手机端调试
使用browser-sync可以让本地项目同步跑在电脑端和任何移动设备上(只要满足在同一局域网下), 非常方便 结合vconsole就可以在移动端实现电脑端页面调试功能.
1首先安装browser-sync
sudo npm install -g browser-sync // 全局安装
2 静态启动
// cd 到项目目录下
browser-sync start --server --files "index.html"
3 动态启动:
browser-sync start --proxy "主机名/ip/域名"
将vconsole的js文件引入就可以实时在手机端进行调试了

页面右下方会出现一个绿色的按钮

点击按钮就会出现类似于网页开发者工具的控制台

就可以在手机上像流览器般进行调试了
网友评论