1、将项目文件夹添加到工作区

VSCode运行html

 

 2、点击“终端”,选择“配置任务”

VSCode运行html

 

 3、选择“使用模板创建tasks.json文件”

VSCode运行html

 

 4、选择“Others”

VSCode运行html

 

 5、tasks.json新建,默认如下

VSCode运行html

 

 6、修改tasks.json

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "在Chrome中运行",
            "type": "process",  // [shell,process]
            "command": "Chrome",
            "args": ["${file}"],
            "windows": {
                "command": "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"
            },
            "group": "build",
            "presentation": {
                // Reveal the output only if unrecognized errors occur.
                "reveal": "never"  //[always,never,silent]
            },
            // Use the standard MS compiler pattern to detect errors, warnings and infos
            "problemMatcher": "$msCompile"
        }
    ]
}

7、选中需要运行的html文件,按住Ctrl+Shift+B,选择“在Chome中运行”

VSCode运行html

 

 VSCode运行html

相关文章:

  • 2021-08-07
  • 2021-09-20
  • 2021-08-23
  • 2022-01-10
  • 2022-12-23
  • 2022-12-23
  • 2021-04-01
  • 2022-12-23
猜你喜欢
  • 2021-12-14
  • 2021-07-31
  • 2021-12-27
  • 2021-06-07
  • 2021-12-17
  • 2021-11-05
  • 2021-04-26
相关资源
相似解决方案