vscode 好用的插件

 

 

 

 

 

html.json.code-snippets

以下是两个配置:

{
/*常用window监听*/
"Print to window.addEventListener": {
"scope": "javascript,typescript",
"prefix": "add",
"body": ["window.addEventListener('key', () => {", " })"],
"description": "window.addEventListener = function"
},
"Print to window.removeEventListener": {
"scope": "javascript,typescript",
"prefix": "rem",
"body": ["window.removeEventListener('key', () => {", " })"],
"description": "window.removeEventListener = function"
},
"Print to setInterval": {
"scope": "javascript,typescript",
"prefix": "setInt",
"body": ["setInterval(() => {", "}, 1000)"],
"description": "setInterval循环执行"
},
"Print to window.onload": {
"scope": "javascript,typescript",
"prefix": "wo",
"body": ["window.onload = ()=>{", "}"],
"description": "window.onload = function"
},
"Print to console": {
"scope": "javascript,typescript",
"prefix": "con",
"body": [
"console.log()"
// "$2"
],
"description": "Log output to console"
},
"Print to alert": {
"scope": "javascript,typescript",
"prefix": "al",
"body": ["alert();"],
"description": "Log output to alert"
},
//then
"Print to then": {
// "scope": "javascript,typescript",
"prefix": ".then",
"body": [
".then(res => {",
"})",
".catch(err => {",
"this.\\$message.error(err)",
"})"
],
"description": ".then函数片段"
},
//数字取整数位
"Print to Math": {
// "scope": "javascript,typescript",
"prefix": "Math",
"body": ["Math.floor()"],
"description": "数字取整数位"
},
/* 常用数组函数*/
//filter
"Print to filter": {
// "scope": "javascript,typescript",
"prefix": "fil",
"body": ["filter(item => {})"],
"description": "数组筛选filter函数"
},
//map
"Print to map": {
// "scope": "javascript,typescript",
"prefix": "map",
"body": ["map(item => {})"],
"description": "数组map重构函数"
},
//forEach
"Print to forEach": {
// "scope": "javascript,typescript",
"prefix": "for",
"body": ["forEach(item => {})"],
"description": "数组forEach函数"
},
//reduce
"Print to Reduce": {
// "scope": "javascript,typescript",
"prefix": "red",
"body": ["reduce((sum, number) => {", "return sum + number", " }, 0)"],
"description": "数组求和"
},
//sort
"Print to sort": {
// "scope": "javascript,typescript",
"prefix": "sort",
"body": ["sort((a, b) => a - b)"],
"description": "数组排序"
},
//数组去重
"Print to Set": {
// "scope": "javascript,typescript",
"prefix": "Set",
"body": ["[...new Set(arr)]"],
"description": "数组去重"
},
//for循环
"Print to fori": {
// "scope": "javascript,typescript",
"prefix": "fi",
"body": ["for(let i = 0;i<$1;i++){", "}"],
"description": "document for i"
},
/* 常用元素DOM获取函数*/
//获取id
"Print to getId": {
// "scope": "javascript,typescript",
"prefix": "do",
"body": ["document.getElementById()"],
"description": "document ById"
},
//获取class
"Print to getClassName": {
// "scope": "javascript,typescript",
"prefix": "dc",
"body": ["document.getElementsByClassName()"],
"description": "document ByClassname"
},
//通用
"Print to querySelector": {
// "scope": "javascript,typescript",
"prefix": "qs",
"body": [" document.querySelector('$1')"],
"description": "document.querySelector"
},
/*文档模板整合*/
"vh": {
"prefix": "vh", // 触发的关键字 输入vh按下tab键
"body": [
"<!DOCTYPE html>",
"<html lang=\"en\">",
"",
"<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\">",
" <title>Document</title>",
" <script src=\"../js/vue.js\"></script>",
"</head>",
"",
"<body>",
" <div id=\"app\"></div>",
" <script>",
" var vm=new Vue({",
" el:'#app',",
" data:{},",
" methods:{}",
" });",
" </script>",
"</body>",
"",
"</html>"
],
"description": "Vue-Html文档"
},
"Print to filters": {
"scope": "javascript,typescript",
"prefix": "filt",
"body": [
"filters: {",
"statusString: function (status) {",
" const map = new Map([",
"[1, '在线'],",
"[2, '异常'],",
"[3, '离线']",
" ])",
"return map.get(status)",
"}",
"},"
],
"description": "Vue过滤函数"
},
"Print to template": {
// "scope": "javascript,typescript",
"prefix": "tem",
"body": ["<template id='$1'>", "</template>"],
"description": "template模板"
},
"Print to templatevue": {
// "scope": "javascript,typescript",
"prefix": "sc",
"body": [
"<template>",
"<div>",
"</div>",
"</template>",
"<script>",
"export default{",
"data (){",
"return{",
"}",
"},",
"mounted() {",
"},",
"methods: {",
"},",
"}",
"</script>",
"<style lang='scss' scoped>",
"</style>"
],
"description": "VUE基础模板"
}
}

 

 

 

 

 

 

 

 

 

 

 

 

 

 


{
//打开文件不覆盖
"workbench.editor.enablePreview": false,
//关闭快速预览
"editor.minimap.enabled": false,
// // 函数注释
// "fileheader.cursorMode": {
// "description": "",
// "param": "",
// "return": ""
// },
// //手机项目rem适配
// "px-to-rem.px-per-rem": 100,
// -----------------------自动格式化配置eslint+prettier-----------------------
// 每次保存自动格式化ctrl+s
"editor.formatOnSave": true,
// 每次保存的时候将代码按eslint格式进行修复
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
//配置内配置对 .vue 文件的格式化
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
//配置内配置对 .ts 文件的格式化
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
//配置内配置对 .js 文件的格式化
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
//配置内配置对 .json 文件的格式化
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"window.zoomLevel": 1,
"editor.quickSuggestions": {
"strings": true
},
"eslint.nodeEnv": "",
"fileheader.Author": "Yingchun",
"fileheader.LastModifiedBy": "Yingchun",
"terminal.integrated.tabs.enabled": false,
"explorer.confirmDelete": false,
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"leek-fund.funds": [
"165520",
"013048",
"161725",
"320007",
"003096",
"005969",
"001838"
],
"leek-fund.stocks": [
"sh000001",
"sz000998",
"sz002459",
"sz002041",
"sh601012"
],
"leek-fund.hideFundBarItem": true,
"leek-fund.stockSort": -1,
"leek-fund.iconType": "food1",
"leek-fund.stockRemindSwitch": 1,
"leek-fund.statusBarStock": [],
"leek-fund.showEarnings": 1,
"leek-fund.fundSort": -1,
"leek-fund.hideStatusBar": true,
"leek-fund.hideStatusBarStock": true,
"leek-fund.interval": 3000,
"leek-fund.newsUserIds": [],
"explorer.confirmDragAndDrop": false
}

 

posted @ 2021-12-01 08:57  笨笨白  阅读(261)  评论(0编辑  收藏  举报