html - 是否可以在 Visual Basic 的一个 html.json 文件中添加多个片段?
问题描述
{
"html":{
"prefix": "html",
"body": [
"<!DOCTYPE html>",
"<html lang='en'>",
"<head>",
"<meta charset='UTF-8'>",
"<link rel='stylesheet' type='text/css' href=' '>",
"<title>",
"</title>",
"</head>",
"<body>",
"</body>",
"</html>",
],
"description": "html"
}
}
{
"css-doodle": {
"prefix": "css-doodle",
"body":[
"<script src='https://unpkg.com/css-doodle@0.7.2/css-doodle.min.js'></script>",
"<css-doodle>",
"content" ,
"</css-doodle>",
],
"description": "doodle",
}
}
所以上面是html的两个片段。但是后一个 css-doodle 不起作用。代码中是否有一些错误或将两者分开的特定方式?
解决方案
我看到它已经 8 个月了,所以把答案放在这里让其他人遇到。您的问题是您的描述后有一个文件括号结尾,并且您缺少逗号。您的第二个片段的开头还有一个文件括号的开头。
您的代码应如下所示:
{
"html":{
"prefix": "html",
"body": [
"<!DOCTYPE html>",
"<html lang='en'>",
"<head>",
"<meta charset='UTF-8'>",
"<link rel='stylesheet' type='text/css' href=' '>",
"<title>",
"</title>",
"</head>",
"<body>",
"</body>",
"</html>",
],
"description": "html"
},
"css-doodle": {
"prefix": "css-doodle",
"body":[
"<script src='https://unpkg.com/css-doodle@0.7.2/css-doodle.min.js'></script>",
"<css-doodle>",
"content" ,
"</css-doodle>",
],
"description": "doodle",
}
}
基本上,对于您要添加的每个代码片段,只需在代码段后放置一个逗号,并将文件括号的结尾放置一次,在 json 的末尾。如您所见,后续片段的名称前没有括号。
希望这可以帮助。我知道我第一次想把头发扯掉。
推荐阅读
- elixir - 返回正确的时间戳
- swagger - 无效的范围 Swagger 和 IdentityServer4
- python - 更改科学轴标签格式的偏移量
- python-3.x - 如何从 openai gym 的自定义环境中调用自定义属性?
- javascript - 具有多个条件的过滤器数组
- java - Ldap 单元测试模拟命名枚举
- apache - help.example.com 的 DNS 记录返回 404
- php - 使用 php artisan migrate refresh 时,laravel 5.8“调用未定义的方法 car:SetContainer()”
- r - 使用 timedate 或 lubridate 将 1 个工作日添加到日期
- python - 具有协方差/相关性的组的多标签分类