当前位置: 首页 > news >正文

wordpress 数据库类型南昌网站优化公司

wordpress 数据库类型,南昌网站优化公司,如何做网站结构优化,网站开发公司郑州做开发总是会有大量的代码要写,但是有时候某些代码是非常基础但是很多,我们就可以把这一部分整合起来,使用一个很简短的关键字来快速唤出。 如何新建这样的代码段? 1.在VSCode当中找到Snippets,然后点击 2.之后会弹出…

做开发总是会有大量的代码要写,但是有时候某些代码是非常基础但是很多,我们就可以把这一部分整合起来,使用一个很简短的关键字来快速唤出。

如何新建这样的代码段?

1.在VSCode当中找到Snippets,然后点击

2.之后会弹出一个框,选择New Global Snippets file

3.弹出一个小框,你在这里书写该自定义代码片段的名称,记得复制下来

4.然后进入具体的文件,就像下面这样

默认模板如下:

{// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope // is left empty or omitted, the snippet gets applied to all languages. 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": {// 	"scope": "javascript,typescript",// 	"prefix": "log",// 	"body": [// 		"console.log('$1');",// 		"$2"// 	],// 	"description": "Log output to console"// }
}

有哪些模板?

自定义axios拦截器并封装

{  // 代码片段的名称,这个名称会显示在代码片段列表中  "axiost": {  "prefix": "axiost", // 触发代码片段的关键字  "body": [  "import axios, { AxiosInstance, InternalAxiosRequestConfig } from 'axios';",  "",  "const creatAxios = (config?: InternalAxiosRequestConfig) => {",  "\tconsole.log('打印配置信息', import.meta.env);",  "\tconst instance: AxiosInstance = axios.create({",  "\t\tbaseURL: import.meta.env.VITE_API_BASE_URL,",  "\t\ttimeout: import.meta.env.VITE_TIMEOUT,",  "\t\twithCredentials: true, // default-false 跨域请求是否需要凭证",  "\t\theaders: {",  "\t\t\t'Content-Type': 'application/json',",  "\t\t\tAccept: 'application/json',",  "\t\t},",  "\t\t...config,",  "\t});",  "",  "\t// 重写请求拦截器规则",  "\tinstance.interceptors.request.use(",  "\t\t(config: InternalAxiosRequestConfig) => {",  "\t\t\t// 在发送请求之前做些什么",  "\t\t\tconsole.log('在发送请求之前做些什么呢?');",  "\t\t\treturn config;",  "\t\t},",  "\t\t(error: any) => {",  "\t\t\t// 对请求错误做些什么",  "\t\t\tconsole.log('对请求错误做些什么呢?');",  "\t\t\treturn Promise.reject(error);",  "\t\t},",  "\t);",  "",  "\t// 重写响应拦截器规则",  "\tinstance.interceptors.response.use(",  "\t\t(response: any) => {",  "\t\t\t// 对响应数据做点什么",  "\t\t\tconsole.log('对响应数据做点什么呢?', response.data.msg);",  "\t\t\tif (response.data.code !== 200) {",  "\t\t\t\tconsole.error(response.data.msg);",  "\t\t\t} else {",  "\t\t\t\tconsole.log(response.data.msg);",  "\t\t\t}",  "\t\t\treturn response;",  "\t\t},",  "\t\t(error: any) => {",  "\t\t\t// 对响应错误做点什么",  "\t\t\tconsole.log('对响应错误做点什么呢?', error);",  "\t\t\treturn Promise.reject(error);",  "\t\t},",  "\t);",  "",  "\treturn instance;",  "};"  ],  "description": "快速生成一个创建Axios实例的函数"  }  
}

在html引入echarts

{// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope // is left empty or omitted, the snippet gets applied to all languages. 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:"echartsUrl": {"scope": "javascript,typescript,html","prefix": "echartsUrl","body": ["<script src=\"https://cdn.jsdelivr.net/npm/echarts/dist/echarts.min.js\"></script>"],"description": "Log output to console"}
}

html板子(这个其实你输入感叹号也可以实现)

{  // 这里是文件的全局描述,不是必须的,但有助于理解  "HTML Templates": {  // 定义一个前缀,当在HTML文件中输入此前缀并按下Tab时,将展开此片段  "Print to console": {  "prefix": "htmlt",  // 描述(可选)  "description": "Log output to console",  // 片段内容  "body": [  "<!DOCTYPE html>",  "<html lang=\"en\">",  "<head>",  "    <meta charset=\"UTF-8\">",  "    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">",  "    <title>Document</title>",  "</head>",  "<body>",  "    <h1>Hello, World!</h1>",  "    <!-- Your HTML content goes here -->",  "</body>",  "</html>"  ]  }  }  
}

html表的模板

{// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope // is left empty or omitted, the snippet gets applied to all languages. 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:"htmltabelt": {"scope": "javascript,typescript,html","prefix": "htmltabelt","body": ["<div id=\"root\" style=\"width: 100vw;height: 100vh\">","    <table>","        <thead>","            <tr>","                <th>xxxxx</th>","            </tr>","        </thead>","        <tbody>","            <tr>","                <td><%= value.xxx%></td>","            </tr>","        </tbody>","    </table>","</div>",],"description": "Log output to console"}
}

html表格样式

{// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope // is left empty or omitted, the snippet gets applied to all languages. 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:"tablestylet": {"scope": "javascript,typescript,html","prefix": "tablestylet","body": ["<style>","@font-face {","    font-family: \"PingFang SC\";","    src: url(\"https://oms-2018-test.oss-cn-hangzhou.aliyuncs.com/template/PingFang_SC_Standard.ttf\");","}","* {","    margin: 0;","    padding: 0;","}","#root {","    font-family: \"PingFang SC\";","    font-size: 32px;","    width: 100%;","}",".redtext {","    color: #e8380d;","}",".yellowtext {","    color: #ffbc3c;","}","table {","    border-collapse: collapse;","    width: 100%;","}","th,","td {","    border: 1px solid #e8e8e8;","    padding: 8px;","    text-align: center;","}","thead tr:first-child th {","    background-color: #eee;","    color: #000;","    text-align: center;","}","tbody tr:last-child td {","    font-weight: bold;","}","</style>",],"description": "Log output to console"}
}

js打印调试语句

{// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope // is left empty or omitted, the snippet gets applied to all languages. 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:"logs": {"scope": "javascript,typescript,vue","prefix": "logs","body": ["console.log('xxxxx');",],"description": "Log output to console"}
}

Vue3组合式快速模板

{// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope // is left empty or omitted, the snippet gets applied to all languages. 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:"vuet": { //快捷输入的时候显示的提示"prefix": "vuet",//输入的前缀,就是输入这个会有提示"description": "vue3模板",//描述"body": [//这个是一个字符串数组,就是会输出的内容,如果内容含有 双引号,需要转义,比如最下面的lang=\"scss\""<template>","  <div></div>","</template>","","<script lang=\"ts\" setup>","","</script>","","<style lang=\"scss\" scoped>","</style>",""]
},
}

最后想说的

代码片段只是提效的手段,作为程序员应该发挥想象力。我这里只是抛砖引玉,介绍一下我的提效方式,你完全可以根据自身特点利用这个功能来做自己的片段!!!

http://www.15wanjia.com/news/2700.html

相关文章:

  • 邢台做网站优化悟空建站seo服务
  • 广州专业做网站公司外贸快车
  • 建设门户网站所需故事性营销软文
  • 网文网站微信小程序开发教程
  • 信息服务类网站建设方案百度员工收入工资表
  • 网页设计与制作教程清华大学出版社seo查询友情链接
  • 厦门做网站seo的seo综合查询什么意思
  • 专门做招商的网站是什么四川百度推广排名查询
  • seo外包方法优化网络的软件
  • 成都网站建设与推广sem托管公司
  • 什么公司网站建设做的好爱站网 关键词挖掘
  • 潍坊百度网站建设在线代理浏览网站
  • 太原阳性确诊西安网站seo技术厂家
  • 诸城市做网站网站建设公司哪家好?该如何选择
  • 外贸网站外链平台广州四楚seo顾问
  • 网站开发后台做些什么aso优化渠道
  • 装修设计图包括哪些图纸百度seo怎么关闭
  • 哪里有做配音的兼职网站营销软文怎么写
  • 韩国漫画漫免费观看免费seo基础教程视频
  • 微信建一个网站网站快速建站
  • 东丽天津网站建设网络营销方式有哪些分类
  • 东莞大朗网站建设如何做seo
  • 网站建设专业公司哪家好互联网营销师
  • 怎么做无损mp3下载网站ip切换工具
  • 做网站属于什么行业电商平台排行榜前十名
  • 济南网站建设是什么意思每日新闻摘要30条
  • 做电商平台网站有哪些站长工具5g
  • 做壁纸网站好优化设计高中
  • 微信h5免费制作网站模板下载外链代发2分一条
  • 电子招标投标平台网站建设东莞好的网站国外站建设价格