偶然发现VScode的功能,开发者可以把自己常用的代码片段配置一下,提高工作效率。
打开vscode编辑器,依次选择“文件 -> 首选项 -> 用户代码片段”,此时,会弹出一个搜索框,我们输入vue,将代码ctrl+c 到vue.json

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)"
  }
Logo

前往低代码交流专区

更多推荐