总结VSCode设置开发中常用的代码片段(未完待续。。。)

偶然发现VScode的功能,开发者可以把自己常用的代码片段配置一下,提高工作效率。

1.vue快速模板:

"Print to console": {
		"prefix": "vue",
		"body": [
			"<template>",
			"  <div class=\"table\">$0</div>",
			"</template>",
			"",
			"<script>",
			"export default {",
			"  components:{},",
			"  props:{},",
			"  data(){",
			"    return {",
			"    }",
			"  },",
			"  computed: {},",
			"  watch: {},",
			"  created(){},",
			"  mounted(){},",
			"  methods:{},",
			"}",
			"</script>",
			"<style scoped>",
			".table{}",
			"</style>"
		],
		"description": "A vue file template"
	}

2.axios快速模板,根据自己公司的代码自定义

"Print to console": {
    "scope": "javascript,typescript",
    "prefix": "axios",
    "body": [
      "this.$$axios({",
      "  method: 'POST',",
      "  url: '',",
      "  data: params",
      "})",
      ".then(res => {",
      "  if (res.data.status == 1) {",
      "    console.log(res.data)",
      "  } else {",
      "    this.$$message(res.data.msg);",
      "  }",
      "})",
      ".catch(error => {});"
    ],
    "description": "axios请求(yxf)"
  }
发布了54 篇原创文章 · 获赞 21 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/qq_42816550/article/details/100032912
今日推荐