javascript 如何在 Chrome 开发人员工具中“添加手表”?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27247350/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to 'add watch' in Chrome developer tools?
提问by Jez
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. Is there really no way to do this in 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?
我似乎找不到在 Chrome 开发人员工具中为选定的 JavaScript 文本添加监视表达式的方法,就像我在 Firebug 中使用 Ctrl+W 一样。在 Chrome 中真的没有办法做到这一点吗?我什至无法右键单击选择,因为它会在我执行后立即取消选择,并且没有“添加监视”上下文菜单项。在调试 JS 时,我真的必须输入我想添加的每个手表吗?
采纳答案by Or Duan
You can do it by clicking 'add to watch' afterright clicking
您可以通过在右键单击后单击“添加到观看”来完成
You can also select the expression/variable and hit Ctrl+ Shift+ A
您还可以选择表达式/变量并点击Ctrl+ Shift+A
回答by KyleMit
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 种方式之一进行操作:
Highlight text, right click, and selct
Add selected text to watches
*Note: this used to be "Add to watch"
Highlight text and press Ctrl+ Shift+ A
Add expression on the watch panel directly in the top right corner of the sources tab
回答by Gal Margalit
You need to double clickthe variable name, then right clickwill reveal the add to watch option.
您需要双击变量名称,然后右键单击将显示添加到监视选项。