3

前端项目本地调试方案

 2 years ago
source link: https://segmentfault.com/a/1190000040143930
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

前端项目在本地调试时都难以跳过登录环节,如果每次都要通过登录去调试就太麻烦了,有没有什么方法避免调试时还需要跳往登录页登录呢?文本梳理出下面三种方案供大家参考:

Cookie手工复制

Cookie复制是一种最简单粗暴的纯手工方案,步骤如下:

  • 先在测试环境进行登录,在控制台中拿到Cookie中的令牌
  • 本地启动前端项目,打开控制台Cookie存储,将刚刚拿到的令牌复制粘贴到该域名下的Cookie存储中,然后刷新页面

这种纯手工的方案也是挺麻烦的,每次也需要去Cookie中找令牌,然后复制,还会出现复制粘贴错误内容。既然手工复制不好,那我们能不能自动化复制呢?答案是可以的,谷歌拓展插件可以做到这一点

谷歌拓展插件

参考文章:


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK