前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >vscode自定义HTML页面自动生成格式

vscode自定义HTML页面自动生成格式

作者头像
天天Lotay
发布2022-12-02 09:40:38
6600
发布2022-12-02 09:40:38
举报
文章被收录于专栏:嵌入式音视频

除了输入“!”和“html”的另外一种可自定义页面的方法,懒人必备!

在这里插入图片描述
在这里插入图片描述

左下角的设置图标 输入html.json

在这里插入图片描述
在这里插入图片描述

它最初长这样:

在这里插入图片描述
在这里插入图片描述

我们把它改成这样

在这里插入图片描述
在这里插入图片描述
代码语言:javascript
复制
{
    // Place your snippets for html here. Each snippet is defined under a snippet name and has a prefix, body and 
    // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
    // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the 
    // same ids are connected.
    // Example:
    // "Print to console": {
    // 	"prefix": "log",
    // 	"body": [
    // 		"console.log('$1');",
    // 		"$2"
    // 	],
    "Print out HTMLMoudules": {
        "prefix": "hm",
        "body": [
            "<!DOCTYPE html>",
            "<html lang=\"cn\">",
            "<head>",
            "   <meta charset=\"UTF-8\">",
            "   <meta name=\"viewport\" content=\"width=device-width,initial-scale=1.0\">",
            "   <meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">",
            "   <script src=\"https://cdn.bootcss.com/vue/2.6.10/vue.js\"></script>",
            "   <title>Document</title>",
            "   <style>",
            "   ",
            "   </style>",
            "</head>",
            "<body>",
            "   $3",
            "   <script>",
            "   ",
            "   </script>",
            "</body>",
            "</html>"
        ],
        "description": "生成带Vue的HTML模板"
    }

    // 	"description": "Log output to console"
    // }

}

ok,以后建html输入"hm"就可以快速输入了

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在json文件中填写配置代码,即可自定义HTML文件格式。

print to 后面填的是你这个代码块的名字 随便取 符合命名规则就行

prefix 冒号里填的是 在 Intellisense 中选择代码片段时将使用的前缀,即你要打出的快捷键

body 冒号后面填的是你要定义的代码段的完整代码

美元$符号+数字代表光标位置 即你打出代码段后光标所在的位置

description 冒号后面填的是 这个代码段的描述 随便写就行

注:引号后面的是空格 不能直接按tab。在HTML页面中输入hm即可生成

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2021-01-19,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档