
配置vscode=》setting.json
{ "workbench.colorTheme": "Default Dark+", "editor.fontSize": 14, "workbench.editor.enablePreview": true, //预览模式关闭 "editor.formatOnSave": true, // #每次保存的时候自动格式化 // 自动修复 "editor.codeActionsOnSave": { "source.fixAll.eslint": true }, "eslint.enable": true, //是否开启vscode的eslint // 配置 ESLint 检查的文件类型 "eslint.validate": ["javascript", "vue", "html"], "eslint.options": { //指定vscode的eslint所处理的文件的后缀 "extensions": [".js", ".vue", ".ts", ".tsx"] }, "files.associations": { "*.wpy": "vue", "*.wxml": "wxml", "*.cjson": "jsonc", "*.wxss": "css", "*.wxs": "javascript", "*.html": "html" }, "emmet.includeLanguages": { "wxml": "html" }, "minapp-vscode.disableAutoConfig": true, // vscode默认启用了根据文件类型自动设置tabsize的选项 "editor.detectIndentation": false, // 重新设定tabsize "editor.tabSize": 2, // #去掉代码结尾的分号 "prettier.semi": false, // #使用单引号替代双引号 "prettier.singleQuote": true, // #让函数(名)和后面的括号之间加个空格 "javascript.format.insertSpaceBeforeFunctionParenthesis": true, // #让vue中的js按编辑器自带的ts格式进行格式化 "vetur.format.defaultFormatter.js": "prettier-eslint", "git.enableSmartCommit": true, "editor.quickSuggestions": { "strings": true }, //一定要在vutur.defaultFormatterOptions参数中设置,单独修改prettier扩展的设置是无法解决这个问题的,因为perttier默认忽略了vue文件(事实上从忽略列表移除vue也不能解决这个问题) "vetur.format.defaultFormatterOptions": { "prettier": { "semi": false, // 格式化不加分号 "singleQuote": true // 格式化以单引号为主 }, "js-beautify-html": { // force-aligned | force-expand-multiline "wrap_attributes": "force-aligned" }, "prettyhtml": { "printWidth": 100, "singleQuote": false, "wrapAttributes": false, "sortAttributes": true } }, // 插件KoroFileHeader // 文件头部注释-快捷键crtl+alt+i(window),ctrl+cmd+t (mac) "fileheader.customMade": { "Descripttion": "", //"version": "", "Author": "voanit", "Date": "Do not edit", "LastEditors": "voanit", "LastEditTime": "Do not Edit" }, //函数注释-快捷键ctrl+alt+t (window), ctrl+alt+t(mac) "fileheader.cursorMode": { "name": "", // "test": "test font", // "msg": "", "param": "", "return": "" }, //安装live Server插件 "liveServer.settings.donotVerifyTags": true, "liveServer.settings.donotShowInfoMsg": true, "liveServer.settings.NoBrowser": true, "liveServer.settings.CustomBrowser": "chrome", //设置默认打开的浏览器 "liveServer.settings.host": "127.0.0.1", "liveServer.settings.port": 5000, //设置本地服务的端口号 "liveServer.settings.root": "/distserver", "[vue]": { "editor.defaultFormatter": "octref.vetur" }, "javascript.updateImportsOnFileMove.enabled": "never", "javascript.implicitProjectConfig.experimentalDecorators": true, "workbench.editor.showTabs": true, "terminal.integrated.rendererType": "dom", "sync.gist": "396472a5bb443e3680d5a0e2ffccefe8", "diffEditor.ignoreTrimWhitespace": true, "launch": {}, "[jsonc]": { "editor.defaultFormatter": "remimarsal.prettier-now" }, "[typescript]": { "editor.defaultFormatter": "remimarsal.prettier-now" }, "json.schemas": [ { "fileMatch": ["/myfile"], "url": "schemaURL" } ], "window.zoomLevel": 1, "files.autoSave": "afterDelay", "tabnine.experimentalAutoImports": true}
www.toutiao.com/article/7033566614775759367/?log_from=09ac5ff4a66a8_1660099414766www.toutiao.com/article/7097529346348384804/?log_from=9f4b5bb79446f_1660099426553

01
// {
// // 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"
// // ],
// // "description": "Log output to console"
// // }
// "Print to vue": {
// "prefix": "vuec",
// "body": [
// "",
// " ",
// " 御剑乘风来,除魔天地间!$1",
// " ",
// "",
// "",
// "",
// "",
// ],
// "description": "create a vue template"
// },
// "Print to v": {
// "prefix": "vue",
// "body": [
// "",
// "",
// "",
// "\t",
// "\t",
// "\tDocument ",
// "\t",
// "",
// "",
// "\t",
// "\t",
// "\t",
// "",
// ""
// ],
// "description": "create a vue template"
// },
// "Print to express": {
// "prefix": "express",
// "body": [
// "const express=require('express')",
// "const app=express()",
// "app.get('/',(req,res)=>{",
// "\tres.send('1111')",
// "})",
// "app.listen(2000,()=>{",
// "\tconsole.log('http://127.0.0.1:2000');",
// "})"
// ]
// },
// "Print to vuex": {
// "prefix": "vuex",
// "body": [
// "export default {",
// "\tnamespaced:true,",
// "\tstate: {",
// " \t\t",
// "\t},",
// "\tmutations: {",
// "\t\t ",
// "\t},",
// "\tactions: {",
// "\t\t ",
// "\t},",
// "}"
// ]
// },
// "Print to ajax": {
// "prefix": "$ajax",
// "body": [
// "$.ajax({",
// "\turl: '',",
// "\ttype:'get',",
// "\tdata:{},",
// "\tsuccess:function(res){",
// "\t\t\t",
// "\t},",
// "})"
// ]
// },
// "Print to rcl": {
// "prefix": "rcl",
// "body": [
// "$2",
// "class Com extends React.Component {",
// "\trender() {",
// "\t\treturn ",
// "\t\t\t御剑乘风来,除魔天地间!$1",
// "\t\t",
// "\t}",
// "}"
// ],
// "description": "类组件"
// },
// "Print to rrcl": {
// "prefix": "rrcl",
// "body": [
// "import React from 'react'",
// "$2",
// "class Com extends React.Component {",
// "\trender() {",
// "\t\treturn ",
// "\t\t\t御剑乘风来,除魔天地间!$1",
// "\t\t",
// "\t}",
// "}",
// "export default Com"
// ],
// "description": "类组件"
// },
// "Print to rfun": {
// "prefix": "rfun",
// "body": [
// "$2",
// "const Func = () => {",
// "\treturn ",
// "\t\t御剑乘风来,除魔天地间!$1",
// "",
// "};",
// ],
// "description": "函数式组件"
// },
// "Print to rrfun": {
// "prefix": "rrfun",
// "body": [
// "import React from 'react'",
// "$2",
// "const Func = () => {",
// "\treturn ",
// "\t\t御剑乘风来,除魔天地间!$1",
// "",
// "};",
// "export default Func"
// ],
// "description": "函数式组件"
// },
// "Print to vuex": {
// "prefix": "vuex",
// "body": [
// "export default {",
// "\tstate () {",
// "\t\treturn {",
// // 文章分类的列表数据
// "\t\t\t",
// "\t\t}",
// "\t},",
// "\tmutations: {",
// // 设置分类列表数据
// "\t\t\t",
// "\t},",
// "\tactions: {",
// "\t},",
// "\tgetters: {},",
// // 开启命名空间
// "\tnamespaced: true",
// "}",
// ],
// "description": "函数式组件"
// },
// "Print to clog": {
// "prefix": "clog",
// "body": [
// "console.log()",
// ],
// "description": "输入打印"
// },
// }
{
// 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('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
// 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 letiables 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')",
],
"description": "Log output to console"
},
"xianshi yuansu": {
"prefix": "db",
"body": [
"box.style.display = 'block'",
],
"description": "设置元素的display为block"
},
"yincang yuansu": {
"prefix": "dn",
"body": [
"box.style.display = 'none'",
],
"description": "设置元素的display为none"
},
"jQuery to click": {
"prefix": "jqc",
"body": [
"$('$1').on('click',function(){\n",
"})",
],
"description": "jQuery注册点击事件"
},
"stop default event": {
"prefix": "ep",
"body": [
"e.preventDefault()",
],
"description": "阻止默认事件"
},
"yulan tupian": {
"prefix": "ajax_yulan",
"body": [
"//1.给file表单元素注册onchange事件",
"$('file表单').change(function () {",
"\t//1.2 获取用户选择的图片",
"\tlet file = this.files[0]",
"\t//1.3 将文件转为src路径",
"\tlet url = URL.createObjectURL(file)",
"\t//1.4 将url路径赋值给img标签的src",
"\t$('img元素').attr('src', url)",
"})"
],
"description": "图片预览固定四个步骤"
},
"comment for function": {
"prefix": "///",
"body": [
"/**",
"* @description:",
"* @param {type} ",
"* @return: ",
"*/",
],
"description": "函数标准注释快捷键"
},
"jquery to ajax": {
"prefix": "ajax",
"body": [
"$.ajax({",
"\turl:'',",
"\ttype:'get',",
"\tdataType:'json',",
"\tdata:'',",
"\tsuccess: function(backData){",
"",
"\t}",
"})"
],
"description": "ajax请求"
},
"get for XMLHTTPRequest": {
"prefix": "ajax1",
"body": [
"//(1).实例化ajax对象",
"let xhr = new XMLHttpRequest()",
"//(2).设置请求方法和地址",
"//get请求的数据直接添加在url的后面 格式是 url?key=value",
"xhr.open('get', '接口url')",
"//(3).发送请求",
"xhr.send()",
"//(4).注册回调函数",
"xhr.onload = function() {",
"\tconsole.log(xhr.responseText)",
"}",
],
"description": "get-原生XMLHTTPRequest实现ajax"
},
"post for XMLHTTPRequest": {
"prefix": "ajax2",
"body": [
"//(1).实例化ajax对象",
"let xhr = new XMLHttpRequest()",
"//(2).设置请求方法和地址",
"xhr.open('post', '$1')",
"//(3).设置请求头(post请求才需要设置)",
"xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded')",
"//(4).发送请求 : 参数格式 'key=value' ",
"xhr.send('key=value')",
"//(5).注册回调函数",
"xhr.onload = function () {",
"\tconsole.log(xhr.responseText)",
"}"
],
"description": "post-原生XMLHTTPRequest实现ajax"
},
"file to ajax": {
"prefix": "ajax-file",
"body": [
"$('提交按钮').on('click',function(e){",
"\t//禁用表单默认提交事件",
"\te.preventDefault()",
"\t//创建FormData对象:参数是表单dom对象",
"\tlet fd = new FormData('form表单DOM对象')",
"\t$.ajax({",
"\t\turl:'',",
"\t\ttype:'post',",
"\t\tdataType:'json',",
"\t\tdata:fd,",
"\t\tcontentType: false,",
"\t\tprocessData: false,",
"\t\tsuccess: function(backData){",
"\t\t}",
"\t})",
"})"
],
"description": "表单提交ajax请求"
},
"express-server": {
"prefix": "express",
"body": [
"//1.导入模块",
"const express = require('express')",
"//2.创建服务器",
"let app = express()",
"//3.开启服务器",
"app.listen(3000,()=>{",
"console.log('success')",
"})"
],
"description": "快速搭建express服务器"
},
"http-server": {
"prefix": "http",
"body": [
"//1.导入模块",
"const http = require('http')",
"\n//2.创建服务器",
"let server = http.createServer((req,res)=>{\n})",
"\n//3.开启服务器",
"server.listen(3000,()=>{",
"\tconsole.log('服务器开启成功')",
"})"
],
"description": "快速搭建http服务器"
},
"get element by id": {
"prefix": "query",
"body": [
"let box = document.querySelector('.box')",
],
"description": "根据id获取元素"
},
"enmu arr": {
"prefix": "fa",
"body": [
"for(let i = 0;i,
"\tconsole.log(arr[i])",
"}",
],
"description": "数组快速for循环遍历"
},
"遍历对象": {
"prefix": "fo",
"body": [
"for(let key in obj){",
"\tlet value = obj[key]",
"}",
],
"description": "遍历对象快捷语法"
},
"axios": {
"prefix": "axios",
"body": [
"axios({",
"\turl:'请求路径',",
"\tmethod:'get',",
"\tdata: { 'post请求参数'},",
"\tparams: { 'get请求参数'}",
"}).then(res=>{",
"\t//成功回调",
"\tconsole.log(res)",
"})",
],
"description": "axios请求"
},
"backgroundColor": {
"prefix": "bgc",
"body": [
"backgroundColor",
],
"description": "背景颜色"
},
"vue-router": {
"prefix": "vr",
"body": [
"//1.创建组件",
"let ym1 = {template:''}",
"let ym2 = {template:''}",
"let ym3 = {template:''}",
"//2.创建路由规则",
"let routes = [",
"\t{path:'/ym1',component:ym1},",
"\t{path:'/ym2',component:ym2},",
"\t{path:'/ym3',component:ym3},",
"]",
"//3.创建路由对象",
"let router = new VueRouter({routes})",
"//4.挂载路由",
"let app = new Vue({",
"\trouter,",
"}).$$mount('#app')",
],
"description": "快速生成路由"
},
// 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"
// ],
// "description": "Log output to console"
// }
"Print to vue": {
"prefix": "vuec",
"body": [
"",
" ",
" 御剑乘风来,除魔天地间!$1",
" ",
"",
" ",
"",
""
],
"description": "create a vue template"
},
"Print to vue3": {
"prefix": "vue3",
"body": [
"",
" ",
" 御剑乘风来,除魔天地间!$1===vue3",
" ",
"",
" ",
"",
""
],
"description": "create a vue template"
},
"Print to vue3-1": {
"prefix": "vue3-1",
"body": [
"",
" ",
" 御剑乘风来,除魔天地间!$1===vue3",
" ",
"",
" ",
"",
""
],
"description": "create a vue template"
},
"Print to v": {
"prefix": "vue",
"body": [
"",
"",
"",
"\t",
"\t",
"\tDocument ",
"\t",
"",
"",
"\t",
"\t",
"\t",
"",
""
],
"description": "create a vue template"
},
"Print to express": {
"prefix": "express",
"body": [
"const express=require('express')",
"const app=express()",
"app.get('/',(req,res)=>{",
"\tres.send('1111')",
"})",
"app.listen(2000,()=>{",
"\tconsole.log('http://127.0.0.1:2000');",
"})"
]
},
"Print to vuex": {
"prefix": "vuex",
"body": [
"export default {",
"\tnamespaced:true,",
"\tstate: {",
" \t\t",
"\t},",
"\tmutations: {",
"\t\t ",
"\t},",
"\tactions: {",
"\t\t ",
"\t},",
"}"
]
},
"Print to ajax": {
"prefix": "$ajax",
"body": [
"$.ajax({",
"\turl: '',",
"\ttype:'get',",
"\tdata:{},",
"\tsuccess:function(res){",
"\t\t\t",
"\t},",
"})"
]
},
"Print to rcl": {
"prefix": "rcl",
"body": [
"$2",
"class Com extends React.Component {",
"\trender() {",
"\t\treturn ",
"\t\t\t御剑乘风来,除魔天地间!$1",
"\t\t",
"\t}",
"}"
],
"description": "类组件"
},
"Print to rrcl": {
"prefix": "rrcl",
"body": [
"import React from 'react'",
"$2",
"class Com extends React.Component {",
"\trender() {",
"\t\treturn ",
"\t\t\t御剑乘风来,除魔天地间!$1",
"\t\t",
"\t}",
"}",
"export default Com"
],
"description": "类组件"
},
"Print to rfun": {
"prefix": "rfun",
"body": [
"$2",
"const Func = () => {",
"\treturn ",
"\t\t御剑乘风来,除魔天地间!$1",
"",
"};",
],
"description": "函数式组件"
},
"Print to rrfun": {
"prefix": "rrfun",
"body": [
"import React from 'react'",
"$2",
"const Func = () => {",
"\treturn ",
"\t\t御剑乘风来,除魔天地间!$1",
"",
"};",
"export default Func"
],
"description": "函数式组件"
},
// "Print to vuex": {
// "prefix": "vuex",
// "body": [
// "export default {",
// "\tstate () {",
// "\t\treturn {",
// // 文章分类的列表数据
// "\t\t\t",
// "\t\t}",
// "\t},",
// "\tmutations: {",
// // 设置分类列表数据
// "\t\t\t",
// "\t},",
// "\tactions: {",
// "\t},",
// "\tgetters: {},",
// // 开启命名空间
// "\tnamespaced: true",
// "}",
// ],
// "description": "函数式组件"
// }
// 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"
// ],
// "description": "Log output to console"
// }
"Print to vue": {
"prefix": "vuec",
"body": [
"",
" ",
" 御剑乘风来,除魔天地间!$1",
" ",
"",
"",
"",
"",
],
"description": "create a vue template"
},
"Print to v": {
"prefix": "vue",
"body": [
"",
"",
"",
"\t",
"\t",
"\tDocument ",
"\t",
"",
"",
"\t",
"\t",
"\t",
"",
""
],
"description": "create a vue template"
},
"Print to express": {
"prefix": "express",
"body": [
"const express=require('express')",
"const app=express()",
"app.get('/',(req,res)=>{",
"\tres.send('1111')",
"})",
"app.listen(2000,()=>{",
"\tconsole.log('http://127.0.0.1:2000');",
"})"
]
},
"Print to vuex": {
"prefix": "vuex",
"body": [
"export default {",
"\tnamespaced:true,",
"\tstate: {",
" \t\t",
"\t},",
"\tmutations: {",
"\t\t ",
"\t},",
"\tactions: {",
"\t\t ",
"\t},",
"}"
]
},
"Print to ajax": {
"prefix": "$ajax",
"body": [
"$.ajax({",
"\turl: '',",
"\ttype:'get',",
"\tdata:{},",
"\tsuccess:function(res){",
"\t\t\t",
"\t},",
"})"
]
},
"Print to rcl": {
"prefix": "rcl",
"body": [
"$2",
"class Com extends React.Component {",
"\trender() {",
"\t\treturn ",
"\t\t\t御剑乘风来,除魔天地间!$1",
"\t\t",
"\t}",
"}"
],
"description": "类组件"
},
"Print to rrcl": {
"prefix": "rrcl",
"body": [
"import React from 'react'",
"$2",
"class Com extends React.Component {",
"\trender() {",
"\t\treturn ",
"\t\t\t御剑乘风来,除魔天地间!$1",
"\t\t",
"\t}",
"}",
"export default Com"
],
"description": "类组件"
},
"Print to rfun": {
"prefix": "rfun",
"body": [
"$2",
"const Func = () => {",
"\treturn ",
"\t\t御剑乘风来,除魔天地间!$1",
"",
"};",
],
"description": "函数式组件"
},
"Print to rrfun": {
"prefix": "rrfun",
"body": [
"import React from 'react'",
"$2",
"const Func = () => {",
"\treturn ",
"\t\t御剑乘风来,除魔天地间!$1",
"",
"};",
"export default Func"
],
"description": "函数式组件"
},
// "Print to vuex": {
// "prefix": "vuex",
// "body": [
// "export default {",
// "\tstate () {",
// "\t\treturn {",
// // 文章分类的列表数据
// "\t\t\t",
// "\t\t}",
// "\t},",
// "\tmutations: {",
// // 设置分类列表数据
// "\t\t\t",
// "\t},",
// "\tactions: {",
// "\t},",
// "\tgetters: {},",
// // 开启命名空间
// "\tnamespaced: true",
// "}",
// ],
// "description": "函数式组件"
// },
"Print to clog": {
"prefix": "clog",
"body": [
"console.log()",
],
"description": "输入打印"
},
}
02
{
// 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('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
// 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 letiables 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')",
],
"description": "Log output to console"
},
"xianshi yuansu": {
"prefix": "db",
"body": [
"box.style.display = 'block'",
],
"description": "设置元素的display为block"
},
"yincang yuansu": {
"prefix": "dn",
"body": [
"box.style.display = 'none'",
],
"description": "设置元素的display为none"
},
"jQuery to click": {
"prefix": "jqc",
"body": [
"$('$1').on('click',function(){\n",
"})",
],
"description": "jQuery注册点击事件"
},
"stop default event": {
"prefix": "ep",
"body": [
"e.preventDefault()",
],
"description": "阻止默认事件"
},
"yulan tupian": {
"prefix": "ajax_yulan",
"body": [
"//1.给file表单元素注册onchange事件",
"$('file表单').change(function () {",
"\t//1.2 获取用户选择的图片",
"\tlet file = this.files[0]",
"\t//1.3 将文件转为src路径",
"\tlet url = URL.createObjectURL(file)",
"\t//1.4 将url路径赋值给img标签的src",
"\t$('img元素').attr('src', url)",
"})"
],
"description": "图片预览固定四个步骤"
},
"comment for function": {
"prefix": "///",
"body": [
"/**",
"* @description:",
"* @param {type} ",
"* @return: ",
"*/",
],
"description": "函数标准注释快捷键"
},
"jquery to ajax": {
"prefix": "ajax",
"body": [
"$.ajax({",
"\turl:'',",
"\ttype:'get',",
"\tdataType:'json',",
"\tdata:'',",
"\tsuccess: function(backData){",
"",
"\t}",
"})"
],
"description": "ajax请求"
},
"get for XMLHTTPRequest": {
"prefix": "ajax1",
"body": [
"//(1).实例化ajax对象",
"let xhr = new XMLHttpRequest()",
"//(2).设置请求方法和地址",
"//get请求的数据直接添加在url的后面 格式是 url?key=value",
"xhr.open('get', '接口url')",
"//(3).发送请求",
"xhr.send()",
"//(4).注册回调函数",
"xhr.onload = function() {",
"\tconsole.log(xhr.responseText)",
"}",
],
"description": "get-原生XMLHTTPRequest实现ajax"
},
"post for XMLHTTPRequest": {
"prefix": "ajax2",
"body": [
"//(1).实例化ajax对象",
"let xhr = new XMLHttpRequest()",
"//(2).设置请求方法和地址",
"xhr.open('post', '$1')",
"//(3).设置请求头(post请求才需要设置)",
"xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded')",
"//(4).发送请求 : 参数格式 'key=value' ",
"xhr.send('key=value')",
"//(5).注册回调函数",
"xhr.onload = function () {",
"\tconsole.log(xhr.responseText)",
"}"
],
"description": "post-原生XMLHTTPRequest实现ajax"
},
"file to ajax": {
"prefix": "ajax-file",
"body": [
"$('提交按钮').on('click',function(e){",
"\t//禁用表单默认提交事件",
"\te.preventDefault()",
"\t//创建FormData对象:参数是表单dom对象",
"\tlet fd = new FormData('form表单DOM对象')",
"\t$.ajax({",
"\t\turl:'',",
"\t\ttype:'post',",
"\t\tdataType:'json',",
"\t\tdata:fd,",
"\t\tcontentType: false,",
"\t\tprocessData: false,",
"\t\tsuccess: function(backData){",
"\t\t}",
"\t})",
"})"
],
"description": "表单提交ajax请求"
},
"express-server": {
"prefix": "express",
"body": [
"//1.导入模块",
"const express = require('express')",
"//2.创建服务器",
"let app = express()",
"//3.开启服务器",
"app.listen(3000,()=>{",
"console.log('success')",
"})"
],
"description": "快速搭建express服务器"
},
"http-server": {
"prefix": "http",
"body": [
"//1.导入模块",
"const http = require('http')",
"\n//2.创建服务器",
"let server = http.createServer((req,res)=>{\n})",
"\n//3.开启服务器",
"server.listen(3000,()=>{",
"\tconsole.log('服务器开启成功')",
"})"
],
"description": "快速搭建http服务器"
},
"get element by id": {
"prefix": "query",
"body": [
"let box = document.querySelector('.box')",
],
"description": "根据id获取元素"
},
"enmu arr": {
"prefix": "fa",
"body": [
"for(let i = 0;i,
"\tconsole.log(arr[i])",
"}",
],
"description": "数组快速for循环遍历"
},
"遍历对象": {
"prefix": "fo",
"body": [
"for(let key in obj){",
"\tlet value = obj[key]",
"}",
],
"description": "遍历对象快捷语法"
},
"axios": {
"prefix": "axios",
"body": [
"axios({",
"\turl:'请求路径',",
"\tmethod:'get',",
"\tdata: { 'post请求参数'},",
"\tparams: { 'get请求参数'}",
"}).then(res=>{",
"\t//成功回调",
"\tconsole.log(res)",
"})",
],
"description": "axios请求"
},
"backgroundColor": {
"prefix": "bgc",
"body": [
"backgroundColor",
],
"description": "背景颜色"
},
"vue-router": {
"prefix": "vr",
"body": [
"//1.创建组件",
"let ym1 = {template:''}",
"let ym2 = {template:''}",
"let ym3 = {template:''}",
"//2.创建路由规则",
"let routes = [",
"\t{path:'/ym1',component:ym1},",
"\t{path:'/ym2',component:ym2},",
"\t{path:'/ym3',component:ym3},",
"]",
"//3.创建路由对象",
"let router = new VueRouter({routes})",
"//4.挂载路由",
"let app = new Vue({",
"\trouter,",
"}).$$mount('#app')",
],
"description": "快速生成路由"
},
// 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"
// ],
// "description": "Log output to console"
// }
"Print to vue": {
"prefix": "vuec",
"body": [
"",
" ",
" 御剑乘风来,除魔天地间!$1",
" ",
"",
" ",
"",
""
],
"description": "create a vue template"
},
"Print to vue3": {
"prefix": "vue3",
"body": [
"",
" ",
" 御剑乘风来,除魔天地间!$1===vue3",
" ",
"",
" ",
"",
""
],
"description": "create a vue template"
},
"Print to vue3-1": {
"prefix": "vue3-1",
"body": [
"",
" ",
" 御剑乘风来,除魔天地间!$1===vue3",
" ",
"",
" ",
"",
""
],
"description": "create a vue template"
},
"Print to v": {
"prefix": "vue",
"body": [
"",
"",
"",
"\t",
"\t",
"\tDocument ",
"\t",
"",
"",
"\t",
"\t",
"\t",
"",
""
],
"description": "create a vue template"
},
"Print to express": {
"prefix": "express",
"body": [
"const express=require('express')",
"const app=express()",
"app.get('/',(req,res)=>{",
"\tres.send('1111')",
"})",
"app.listen(2000,()=>{",
"\tconsole.log('http://127.0.0.1:2000');",
"})"
]
},
"Print to vuex": {
"prefix": "vuex",
"body": [
"export default {",
"\tnamespaced:true,",
"\tstate: {",
" \t\t",
"\t},",
"\tmutations: {",
"\t\t ",
"\t},",
"\tactions: {",
"\t\t ",
"\t},",
"}"
]
},
"Print to ajax": {
"prefix": "$ajax",
"body": [
"$.ajax({",
"\turl: '',",
"\ttype:'get',",
"\tdata:{},",
"\tsuccess:function(res){",
"\t\t\t",
"\t},",
"})"
]
},
"Print to rcl": {
"prefix": "rcl",
"body": [
"$2",
"class Com extends React.Component {",
"\trender() {",
"\t\treturn ",
"\t\t\t御剑乘风来,除魔天地间!$1",
"\t\t",
"\t}",
"}"
],
"description": "类组件"
},
"Print to rrcl": {
"prefix": "rrcl",
"body": [
"import React from 'react'",
"$2",
"class Com extends React.Component {",
"\trender() {",
"\t\treturn ",
"\t\t\t御剑乘风来,除魔天地间!$1",
"\t\t",
"\t}",
"}",
"export default Com"
],
"description": "类组件"
},
"Print to rfun": {
"prefix": "rfun",
"body": [
"$2",
"const Func = () => {",
"\treturn ",
"\t\t御剑乘风来,除魔天地间!$1",
"",
"};",
],
"description": "函数式组件"
},
"Print to rrfun": {
"prefix": "rrfun",
"body": [
"import React from 'react'",
"$2",
"const Func = () => {",
"\treturn ",
"\t\t御剑乘风来,除魔天地间!$1",
"",
"};",
"export default Func"
],
"description": "函数式组件"
},
// "Print to vuex": {
// "prefix": "vuex",
// "body": [
// "export default {",
// "\tstate () {",
// "\t\treturn {",
// // 文章分类的列表数据
// "\t\t\t",
// "\t\t}",
// "\t},",
// "\tmutations: {",
// // 设置分类列表数据
// "\t\t\t",
// "\t},",
// "\tactions: {",
// "\t},",
// "\tgetters: {},",
// // 开启命名空间
// "\tnamespaced: true",
// "}",
// ],
// "description": "函数式组件"
// }
// 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"
// ],
// "description": "Log output to console"
// }
"Print to vue": {
"prefix": "vuec",
"body": [
"",
" ",
" 御剑乘风来,除魔天地间!$1",
" ",
"",
"",
"",
"",
],
"description": "create a vue template"
},
"Print to v": {
"prefix": "vue",
"body": [
"",
"",
"",
"\t",
"\t",
"\tDocument ",
"\t",
"",
"",
"\t",
"\t",
"\t",
"",
""
],
"description": "create a vue template"
},
"Print to express": {
"prefix": "express",
"body": [
"const express=require('express')",
"const app=express()",
"app.get('/',(req,res)=>{",
"\tres.send('1111')",
"})",
"app.listen(2000,()=>{",
"\tconsole.log('http://127.0.0.1:2000');",
"})"
]
},
"Print to vuex": {
"prefix": "vuex",
"body": [
"export default {",
"\tnamespaced:true,",
"\tstate: {",
" \t\t",
"\t},",
"\tmutations: {",
"\t\t ",
"\t},",
"\tactions: {",
"\t\t ",
"\t},",
"}"
]
},
"Print to ajax": {
"prefix": "$ajax",
"body": [
"$.ajax({",
"\turl: '',",
"\ttype:'get',",
"\tdata:{},",
"\tsuccess:function(res){",
"\t\t\t",
"\t},",
"})"
]
},
"Print to rcl": {
"prefix": "rcl",
"body": [
"$2",
"class Com extends React.Component {",
"\trender() {",
"\t\treturn ",
"\t\t\t御剑乘风来,除魔天地间!$1",
"\t\t",
"\t}",
"}"
],
"description": "类组件"
},
"Print to rrcl": {
"prefix": "rrcl",
"body": [
"import React from 'react'",
"$2",
"class Com extends React.Component {",
"\trender() {",
"\t\treturn ",
"\t\t\t御剑乘风来,除魔天地间!$1",
"\t\t",
"\t}",
"}",
"export default Com"
],
"description": "类组件"
},
"Print to rfun": {
"prefix": "rfun",
"body": [
"$2",
"const Func = () => {",
"\treturn ",
"\t\t御剑乘风来,除魔天地间!$1",
"",
"};",
],
"description": "函数式组件"
},
"Print to rrfun": {
"prefix": "rrfun",
"body": [
"import React from 'react'",
"$2",
"const Func = () => {",
"\treturn ",
"\t\t御剑乘风来,除魔天地间!$1",
"",
"};",
"export default Func"
],
"description": "函数式组件"
},
// "Print to vuex": {
// "prefix": "vuex",
// "body": [
// "export default {",
// "\tstate () {",
// "\t\treturn {",
// // 文章分类的列表数据
// "\t\t\t",
// "\t\t}",
// "\t},",
// "\tmutations: {",
// // 设置分类列表数据
// "\t\t\t",
// "\t},",
// "\tactions: {",
// "\t},",
// "\tgetters: {},",
// // 开启命名空间
// "\tnamespaced: true",
// "}",
// ],
// "description": "函数式组件"
// },
"Print to clog": {
"prefix": "clog",
"body": [
"console.log()",
],
"description": "输入打印"
},
}

// {
// // "eslint.alwaysSHowStatus":true,
// "editor.fontSize": 18,
// "liveServer.settings.donotShowInfoMsg": true,
// "explorer.confirmDragAndDrop": false,
// "[html]": {
// "editor.defaultFormatter": "vscode.html-language-features"
// },
// "editor.formatOnSave": true,
// "[css]": {
// "editor.defaultFormatter": "esbenp.prettier-vscode"
// },
// "explorer.confirmDelete": false,
// "editor.tabSize": 2,
// "bracketPairColorizer.depreciation-notice": false,
// "bracket-pair-colorizer-2.depreciation-notice": false,
// "[less]": {
// "editor.defaultFormatter": "HookyQR.beautify"
// },
// "[javascript]": {
// "editor.defaultFormatter": "HookyQR.beautify"
// },
// "security.workspace.trust.untrustedFiles": "open",
// "editor.accessibilitySupport": "off",
// "workbench.editor.enablePreview": false,
// "editor.fontWeight": "normal",
// "terminal.integrated.defaultProfile.windows": "Windows PowerShell",
// "terminal.integrated.profiles.windows": {
// "PowerShell": {
// "source": "PowerShell",
// "icon": "terminal-powershell"
// },
// "Command Prompt": {
// "path": [
// "${env:windir}\\Sysnative\\cmd.exe",
// "${env:windir}\\System32\\cmd.exe"
// ],
// "args": [],
// "icon": "terminal-cmd"
// },
// "Git Bash": {
// "source": "Git Bash"
// },
// "Windows PowerShell": {
// "path": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
// }
// },
// "[vue]": {
// "editor.defaultFormatter": "esbenp.prettier-vscode"
// },
// "lsby_gitee_vscode_plugin.personal_access_tokens": "37f970b6beffe8fe0f3e05d82044234c",
// "vetur.completion.scaffoldSnippetSources": {
// "workspace": "💼",
// "user": "🗒️",
// "vetur": "✌"
// },
// "git.enableSmartCommit": true
// // "less.compile":{
// // "out":"../lesscss/"
// // }
// }
// {
// "editor.fontSize": 18,
// "eslint.enable": true,
// "eslint.run": "onType",
// "eslint.options": {
// "extensions": [
// ".js",
// ".vue",
// ".jsx",
// ".tsx"
// ]
// },
// "editor.codeActionsOnSave": {
// "source.fixAll.eslint": true
// },
// "editor.unicodeHighlight.allowedCharacters": {
// "": true
// },
// "explorer.confirmDelete": false,
// "git.suggestSmartCommit": false,
// "github.copilot.enable": {
// "*": true,
// "yaml": false,
// "plaintext": false,
// "markdown": false,
// "html": true,
// "Log": false,
// "javascript": true,
// "vue": true
// },
// "liveServer.settings.donotShowInfoMsg": true,
// "editor.inlineSuggest.enabled": true,
// "github-enterprise.uri": "https://github.com/xiguachigua",
// "[html]": {
// "editor.defaultFormatter": "vscode.html-language-features"
// },
// "window.zoomLevel": -1,
// "sync.forceUpload": true,
// "sync.quietSync": true,
// "sync.forceDownload": true,
// "sync.autoUpload": true,
// "sync.autoDownload": true,
// "sync.gist": "chengzipi",
// "[vue]": {
// "editor.defaultFormatter": "octref.vetur"
// },
// "liveServer.settings.AdvanceCustomBrowserCmdLine": "",
// }
// /*
// {
// "editor.fontSize": 18,"eslint.enable": true,
// "eslint.run": "onType",
// "eslint.options": {
// "extensions": [
// ".js",
// ".vue",
// ".jsx",
// ".tsx"
// ]
// },
// "editor.codeActionsOnSave": {
// "source.fixAll.eslint": true
// }
// }
// */
{
"workbench.colorTheme": "Default Dark+",
"editor.fontSize": 14,
"workbench.editor.enablePreview": true, //预览模式关闭
"editor.formatOnSave": true, // #每次保存的时候自动格式化
// 自动修复
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.enable": true, //是否开启vscode的eslint
// 配置 ESLint 检查的文件类型
"eslint.validate": [
"javascript",
"vue",
"html"
],
"eslint.options": {
//指定vscode的eslint所处理的文件的后缀
"extensions": [
".js",
".vue",
".ts",
".tsx"
]
},
"files.associations": {
"*.wpy": "vue",
"*.wxml": "wxml",
"*.cjson": "jsonc",
"*.wxss": "css",
"*.wxs": "javascript",
"*.html": "html"
},
"emmet.includeLanguages": {
"wxml": "html"
},
"minapp-vscode.disableAutoConfig": true,
// vscode默认启用了根据文件类型自动设置tabsize的选项
"editor.detectIndentation": false,
// 重新设定tabsize
"editor.tabSize": 2,
// #去掉代码结尾的分号
"prettier.semi": false,
// #使用单引号替代双引号
"prettier.singleQuote": true,
// #让函数(名)和后面的括号之间加个空格
"javascript.format.insertSpaceBeforeFunctionParenthesis": true,
// #让vue中的js按编辑器自带的ts格式进行格式化
"vetur.format.defaultFormatter.js": "prettier-eslint",
"git.enableSmartCommit": true,
"editor.quickSuggestions": {
"strings": true
},
//一定要在vutur.defaultFormatterOptions参数中设置,单独修改prettier扩展的设置是无法解决这个问题的,因为perttier默认忽略了vue文件(事实上从忽略列表移除vue也不能解决这个问题)
"vetur.format.defaultFormatterOptions": {
"prettier": {
"semi": false, // 格式化不加分号
"singleQuote": true // 格式化以单引号为主
},
"js-beautify-html": {
// force-aligned | force-expand-multiline
"wrap_attributes": "force-aligned"
},
"prettyhtml": {
"printWidth": 100,
"singleQuote": false,
"wrapAttributes": false,
"sortAttributes": true
}
},
// 插件KoroFileHeader
// 文件头部注释-快捷键crtl+alt+i(window),ctrl+cmd+t (mac)
"fileheader.customMade": {
"Descripttion": "",
//"version": "",
"Author": "voanit",
"Date": "Do not edit",
"LastEditors": "voanit",
"LastEditTime": "Do not Edit"
},
//函数注释-快捷键ctrl+alt+t (window), ctrl+alt+t(mac)
"fileheader.cursorMode": {
"name": "",
// "test": "test font",
// "msg": "",
"param": "",
"return": ""
},
//安装live Server插件
"liveServer.settings.donotVerifyTags": true,
"liveServer.settings.donotShowInfoMsg": true,
"liveServer.settings.NoBrowser": true,
"liveServer.settings.CustomBrowser": "chrome", //设置默认打开的浏览器
"liveServer.settings.host": "127.0.0.1",
"liveServer.settings.port": 5000, //设置本地服务的端口号
"liveServer.settings.root": "/distserver",
"[vue]": {
"editor.defaultFormatter": "octref.vetur"
},
"javascript.updateImportsOnFileMove.enabled": "never",
"workbench.editor.showTabs": true,
"terminal.integrated.rendererType": "dom",
"diffEditor.ignoreTrimWhitespace": true,
"launch": {},
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"[typescript]": {
"editor.defaultFormatter": "remimarsal.prettier-now"
},
"json.schemas": [
{
"fileMatch": [
"/myfile"
],
"url": "schemaURL"
}
],
"tabnine.experimentalAutoImports": true,
"editor.inlineSuggest.enabled": true,
"github.copilot.enable": {
"*": false,
"yaml": false,
"plaintext": false,
"markdown": false,
"javascript": true,
"vue": true,
"Log": true,
"html": true
},
"explorer.confirmDelete": false,
"sync.forceUpload": true,
"sync.forceDownload": true,
"sync.autoUpload": true,
"sync.autoDownload": true,
"[json]": {
"editor.defaultFormatter": "remimarsal.prettier-now"
},
"sync.quietSync": true,
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
},
"[javascript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"explorer.confirmDragAndDrop": false,
"emmet.triggerExpansionOnTab": true,
"eslint.codeActionsOnSave.rules": null
}

其他的配置参考
{
"explorer.confirmDelete": false,
"editor.tabSize": 2,
"editor.wordWrap": "on",
"security.workspace.trust.untrustedFiles": "open",
"vscode-edge-devtools.mirrorEdits": true,
"javascript.format.insertSpaceBeforeFunctionParenthesis": true, // 让函数名和后面的括号之间加个空格
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
},
"cssrem.rootFontSize": 37.5,
"[css]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.fontSize": 16,
"px-to-vw.viewportWidth": 375,
"[less]": {
"editor.defaultFormatter": "HookyQR.beautify"
},
"bracket-pair-colorizer-2.depreciation-notice": false,
"launch": {
"configurations": []
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[vue]": {
"editor.defaultFormatter": "octref.vetur"
},
"vetur.completion.scaffoldSnippetSources": {
"workspace": "💼",
"user": "🗒️",
"vetur": "✌"
},
"vetur.format.defaultFormatterOptions": {
"prettier": {
//设置分号
"semi": false,
//双引号变成单引号
"singleQuote": true,
// 每行超过多少字符自动换行
"printWidth": 1000,
// html标签属性换行
"wrapAttributes": true,
"javascript.format.insertSpaceBeforeFunctionParenthesis": false,
"vetur.format.defaultFormatter.js": "vscode-typescript",
//禁止随时添加逗号,这个很重要。找了好久
// "trailingComma": "none",
//解决>换行问题
// "htmlWhitespaceSensitivity": "ignore"
},
"js-beautify-html": {
"wrap_line_length": 100, // 数值越大,一行放的属性越多
"wrap_attributes": "auto",
"end_with_newline": false
},
"prettyhtml": {
"printWidth": 100,
"singleQuote": false,
"wrapAttributes": false,
"sortAttributes": false
}
},
"vetur.format.defaultFormatter.html": "js-beautify-html",
"vetur.format.defaultFormatter.js": "vscode-typescript",
"extensions.ignoreRecommendations": true,
"eslint.enable": true,
"eslint.run": "onType",
"eslint.options": {
"extensions": [
".js",
".vue",
".jsx",
".tsx"
]
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"editor.detectIndentation": false, //关闭检测第一个tab后面就tab
"javascript.format.insertSpaceBeforeFunctionParenthesis": false,
"terminal.integrated.confirmOnKill": "panel",
"workbench.editor.highlightModifiedTabs": true,//去掉在方法之前加空格
"git.path": "",
"editor.formatOnSaveMode": "modifications",
"liveServer.settings.donotShowInfoMsg": true,
"github.copilot.advanced": {
},
"github.copilot.enable": {
"*": true,
"yaml": false,
"plaintext": true,
"markdown": false,
"javascript": true,
"vue": true
},
"settingsSync.ignoredExtensions": [
],
"editor.inlineSuggest.enabled": true,
"emmet.showSuggestionsAsSnippets": true,
"emmet.triggerExpansionOnTab": true,
"emmet.useInlineCompletions": true,
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"prettier.printWidth": 100, // 超过最大值换行
"prettier.tabWidth": 4, // 缩进字节数
"prettier.useTabs": false, // 缩进不使用tab,使用空格
"prettier.semi": false, // 句尾添加分号
"prettier.singleQuote": true, // 使用单引号代替双引号
"prettier.proseWrap": "preserve", // 默认值。因为使用了一些折行敏感型的渲染器(如GitHub comment)而按照markdown文本样式进行折行
"prettier.arrowParens": "avoid", // (x) => {} 箭头函数参数只有一个时是否要有小括号。avoid:省略括号
"prettier.bracketSpacing": true, // 在对象,数组括号与文字之间加空格 "{ foo: bar }"
"prettier.disableLanguages": ["vue"], // 不格式化vue文件,vue文件的格式化单独设置
"prettier.htmlWhitespaceSensitivity": "ignore",
"prettier.ignorePath": ".prettierignore", // 不使用prettier格式化的文件填写在项目的.prettierignore文件中
"prettier.jsxBracketSameLine": false, // 在jsx中把'>' 单独放一行
"prettier.jsxSingleQuote": false, // 在jsx中使用单引号代替双引号
"prettier.requireConfig": false, // Require a 'prettierconfig' to format prettier
"prettier.trailingComma": "es5",
"tabnine.experimentalAutoImports": true,
"[scss]": {
"editor.defaultFormatter": "vscode.css-language-features"
},
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}, // 在对象或数组最后一个元素后面是否加逗号(在ES5中加尾逗号)
}