我已经启动了React应用程序的Chrome调试:
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}"
}
应用程序运行时,它会在断点处停止,例如:
isActive(index) {
return index === this.state.activePanelIndex;
}
但是在Debug Console
或Watch
窗口中,我都可以访问变量,例如(不悬停):
index ReferenceError:索引未定义
this.state.activePanelIndex TypeError:无法读取属性
“ unactivePanelIndex”(未定义this.state未定义)
那是为什么?我该如何解决?