chrome 调试指南
Opened this issue · 10 comments
kangkai124 commented
关于chrome
kangkai124 commented
kangkai124 commented
kangkai124 commented
kangkai124 commented
kangkai124 commented
$
$0 是对当前选中的 html 节点的引用
$1 是对上一次选择的节点的引用
$2 是对在那之前选择的节点的引用,等等一直到 $4
$
和 $$
$
是 document.querySelector 的别名
$$
执行 document.QuerySelectorAll 并返回一个节点数组,而不是 node list
Array.from(document.querySelectorAll('.class-name')) === $$('.class-name') // true
$_
对上次执行结果的引用
$i
在 Dev Tools 里面来使用 npm 插件,需要安装 Chrome 插件 Console Importer
kangkai124 commented
被 async 包裹的 console
(async () => {
response = await fetch('http://api.com/xx/xx')
json = await response.json()
console.log(json)
})
在 DevTools console 里可以这样写:
response = await fetch('http://api.com/xx/xx')
json = await response.json()
kangkai124 commented
kangkai124 commented
console.dir
打印一个 DOM 节点,并且可以看到属性。
kangkai124 commented
console.log
加上 CSS 样式
console.log('%cHello World', 'font-size:20px;color:red')
kangkai124 commented