在左側(cè)擴(kuò)展中搜索Debugger for Chrome并點(diǎn)擊安裝
在自己的html工程目錄下面點(diǎn)擊f5,或者在左側(cè)選擇調(diào)試按鈕
選擇下拉按鈕,會(huì)有一個(gè)添加,選擇chrome
之后會(huì)出現(xiàn)laungh.json的配置文件在自己的項(xiàng)目目錄下面
不過對(duì)于不同的代碼文件要調(diào)試的話,每次都需要修改一下配置文件
{ "version": "0.2.0", "configurations": [{ "type": "chrome", "request": "launch", "name": "Launch Chrome against localhost", "url": "http://localhost:8080", "webRoot": "${workspaceRoot}" }, { "type": "chrome", "request": "attach", "name": "Attach to Chrome", "port": 9222, "webRoot": "${workspaceRoot}" }, { "name": "Launch index.html (disable sourcemaps)", "type": "chrome", "request": "launch", "sourceMaps": false, "file": "${workspaceRoot}/jsTest/test1/test1.html" #每次需要修改這里的文件地址 } ] }
到這里就可以進(jìn)行調(diào)試了,在
中選擇 Launch index.html (disable sourcemaps) 調(diào)試項(xiàng),按f5調(diào)試,會(huì)出現(xiàn),同時(shí)打開goole瀏覽器,點(diǎn)擊
即可進(jìn)入調(diào)試階段。
相關(guān)文章教程推薦:vscode教程