打开用户代码片段 javascript.json:,复制粘贴下面代码
{
// Place your snippets for javascript 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($0)"
],
"description": "Log output to console"
},
"alert": {
"prefix": "al",
"body": [
"alert('$0');"
],
"description": "alert"
},
"document.write": {
"prefix": "dw",
"body": [
"document.write('$0');"
],
"description": "document.write"
},
"prompt": {
"prefix": "po",
"body": [
"prompt('$0');"
],
"description": "prompt"
},
"confirm": {
"prefix": "cf",
"body": [
"confirm('$0');"
],
"description": "confirm"
},
"getElementById": {
"prefix": "dgi",
"body": [
"document.getElementById('$1')"
],
"description": "getElementById"
},
"do-while": {
"prefix": "dow",
"body": [
"do {",
"\t$0",
"} while();"
],
"description": "do-while"
},
"new Array": {
"prefix": "newa",
"body": [
"new Array($0)"
],
"description": "new Array"
},
"arr3": {
"prefix": "a3",
"body": [
"let arr = [1,2,3]"
],
"description": "arr3"
},
"arr5": {
"prefix": "a5",
"body": [
"let arr = [1,2,3,4,5]"
],
"description": "arr5"
},
"arr10": {
"prefix": "a10",
"body": [
"let arr = [1,2,3,4,5,6,7,8,9,10]"
],
"description": "arr10"
},
"forarr": {
"prefix": "fori",
"body": [
"for(let i = 0;i < $1.length;i++) {",
"\t$0",
"}"
],
"description": "arr10"
},
"forar": {
"prefix": "forj",
"body": [
"for(let j = 0;j < $1.length;j++) {",
"\t$0",
"}"
],
"description": "arr10"
},
"optc": {
"prefix": "optc",
"body": [
"Object.prototype.toString.call($0)"
],
"description": "optc"
},
"new Obj": {
"prefix": "newo",
"body": [
"new Object();"
],
"description": "new Obj"
},
"getEleById": {
"prefix": "dgi",
"body": [
"document.getElementById('$0')"
],
"description": "getElementById"
},
"getEleByTag": {
"prefix": "dgt",
"body": [
"document.getElementsByTagName('$0')"
],
"description": "getElementByTag"
},
"getEleByClass": {
"prefix": "dgc",
"body": [
"document.getElementsByClassName('$0')"
],
"description": "getElementByClass"
},
"queryselector": {
"prefix": "doq",
"body": [
"document.querySelector('$0')"
],
"description": "querySelector"
},
"querySelectorAll": {
"prefix": "doa",
"body": [
"document.querySelectorAll('$0')"
],
"description": "querySelectorAll"
},
"onload": {
"prefix": "wod",
"body": [
"window.onload = function () {",
"\t$0",
"}"
],
"description": "window.onload"
},
"for": {
"prefix": "fo",
"body": [
"for(let i = 0;i < $0;i++) {",
"\t",
"}"
],
"description": "for"
},
"documentCreate": {
"prefix": "doc",
"body": [
"document.createElement('$0')"
],
"description": "doc"
},
"getStyle": {
"prefix": "wgs",
"body": [
"window.getComputedStyle($0,null)['']"
],
"description": "wgs"
},
"event": {
"prefix": "ew",
"body": [
"e = window.event || e"
],
"description": "window.event"
}
}
setting.json设置:打开文件,首选项,设置,用户 ,找到:setting.json:,
复制粘贴下面代码:
{
"liveServer.settings.donotVerifyTags": true,
"emmet.syntaxProfiles": {
"vue-html": "html",
"vue": "html"
},
"emmet.includeLanguages": {
"vue-html": "html",
"vue": "html"
},
"explorer.confirmDelete": false,
"explorer.confirmDragAndDrop": false,
// "workbench.colorTheme": "Visual Studio Dark",
"window.zoomLevel": -2,
"files.associations": {
"*.vue": "vue"
},
"git.enableSmartCommit": true,
"prettier.tabWidth": 4,
"vetur.format.defaultFormatter.html": "prettier",
"liveServer.settings.donotShowInfoMsg": true,
"editor.fontSize": 20,
"emmet.variables": {
"lang": "zh-CN"
},
"files.autoSave": "off",
"editor.formatOnType": true,
"editor.formatOnSave": true, //保存整理格式
"editor.tokenColorCustomizations": {
"comments": "#82e0aa" // 注释
},
"workbench.iconTheme": "vscode-icons",
"cssrem.rootFontSize": 24, // 计算时基准值
"cssrem.fixedDigits": 3, // 取3位小数
"cssrem.autoRemovePrefixZero": false, //是否去除0
"workbench.colorTheme": "Monokai Dimmed",
"launch": {},
"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"prettier.singleQuote": true,
"prettier.semi": false,
"editor.codeActionsOnSave": null
}