打开html文件,然后运行->“启动Chrome”。
lauch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9003
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9003
},
{
"type": "chrome",
"request": "attach",
"name": "Attach Chrome",
"url": "http://localhost/${workspaceFolderBasename}/${relativeFile}",
"webRoot": "${workspaceFolder}",
"port": 80,
"userDataDir": "${workspaceFolder}/.vscode/chrome",
},
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome",
"url": "http://localhost/${workspaceFolderBasename}/${relativeFile}",
"webRoot": "${workspaceFolder}",
"userDataDir": "${workspaceFolder}/.vscode/chrome",
},
]
}