zoukankan      html  css  js  c++  java
  • VS Code 如何直接在浏览器中预览页面

    VS Code 预览html页面的时候,默认需要在资源管理器中显示,再在浏览器中预览。今天介绍一下如何直接预览html页面。

    方法一:自己配置快捷键

    1.ctrl + shift + p 或者 F1 打开 命令面板,输入 Configure Task.

    2.选择tasks.json,将里面的内容换成如下,version填写你自己的版本号,我的是2.0.0,command里面填写你的浏览器路径:

    {
        // See https://go.microsoft.com/fwlink/?LinkId=733558
        // for the documentation about the tasks.json format
        "version": "2.0.0",
        "tasks": [
            {
                "taskName": "Chrome",
                "type": "process",
                "command": "chrome.exe",
                "windows": {
                    "command": "C:\Users\ShiShuo\AppData\Local\Google\Chrome\Application\chrome.exe"  
                },
                "args": [
                    "${file}"
                ],
                "problemMatcher": []
            }
        ]
    }

    3.Alt+F --> p --> k 打开 快捷键配置文件 keybindings.json,并输入如下内容:

    // Place your key bindings in this file to overwrite the defaults
    [
        {
            "key": "ctrl+shift+b",
            "command": "workbench.action.tasks.runTask",
            "args": "Chrome"
        }
    ]

    里面的key是你自己想要设置的快捷键组合,注意不要与其他快捷键组合有冲突。

    方法二:安装“view in browser”插件

    点击1  --> 在2处输入“view in browser” --> 选择3,安装即可。

    在文件处,鼠标右键,可以看到【view in browser】这一栏了。

  • 相关阅读:
    C# 各版本的新特性
    EntityFramework增删改查
    web.config配置文件中的configSource属性
    IOC
    权限系统设计实现
    代码依赖和解除具体依赖的技术
    ajax利用html5新特性带进度条上传文件
    React Native 从入门到原理
    npm中本地安装命令行类型的模块是不注册Path的
    需求分析-验证控件的功能需求列表
  • 原文地址:https://www.cnblogs.com/sese/p/9359028.html
Copyright © 2011-2022 走看看