简体   繁体   English

如何在 Chrome 开发人员工具中“添加手表”?

[英]How to 'add watch' in Chrome developer tools?

I can't seem to find a way to add a watch expression for the selected JavaScript text in Chrome developer tools, the same way I would in Firebug with Ctrl+W.我似乎找不到在 Chrome 开发人员工具中为所选 JavaScript 文本添加监视表达式的方法,就像我在 Firebug 中使用 Ctrl+W 一样。 Is there really no way to do this in Chrome?在 Chrome 中真的没有办法做到这一点吗? I can't even right-click the selection as it unselects as soon as I do it, and there is no "Add watch" context menu item.我什至无法右键单击选择,因为它会在我执行后立即取消选择,并且没有“添加监视”上下文菜单项。 Do I really have to type in every watch I want to add while debugging JS?我真的必须在调试 JS 时输入我想添加的每个手表吗?

You can do it by clicking ' add to watch ' after right clicking您可以通过右键单击单击“添加到观看”来完成

You can also select the expression/variable and hit Ctrl + Shift + A您还可以选择表达式/变量并按Ctrl + Shift + A

From the Chrome DevTool docs on JS Debugging Reference > Watch the values of custom JavaScript Expressions , you can do it in 1 of 3 ways:JS Debugging Reference > Watch the values of custom JavaScript Expressions上的 Chrome DevTool 文档中,您可以通过以下 3 种方式之一进行操作:

  1. Highlight text, right click, and selct Add selected text to watches突出显示文本,右键单击,然后选择Add selected text to watches

    将选定的文本添加到手表

    *Note : this used to be "Add to watch" *注意:这曾经是“添加到观看”

  2. Highlight text and press Ctrl + Shift + A突出显示文本并按Ctrl + Shift + A

  3. Add expression on the watch panel directly in the top right corner of the sources tab直接在源选项卡右上角的监视面板上添加表达式

    添加监视表达式

您需要双击变量名称,然后右键单击将显示添加到监视选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM