Home  >  Article  >  Development Tools  >  A brief discussion on how to configure and generate custom templates in VSCode

A brief discussion on how to configure and generate custom templates in VSCode

青灯夜游
青灯夜游forward
2021-08-03 19:36:044398browse

How does VSCode quickly generate custom templates? This article will introduce to you how to configure and generate custom templates in VSCode.

A brief discussion on how to configure and generate custom templates in VSCode

1. Install VSCode

Download address: https://code.visualstudio.com/

Start vsCode after the installation is complete, omitting 10,000 words here.... [Recommended learning: "vscode tutorial"]

2 . Call up the VSCode console

Windows shortcut key: Ctrl Shift P

macOS shortcut key: command Shift P

A brief discussion on how to configure and generate custom templates in VSCode

3. Enter "snippets" and select

A brief discussion on how to configure and generate custom templates in VSCode

## 4. There are many code snippets for custom writing as follows

A brief discussion on how to configure and generate custom templates in VSCode

5. We use vue files for demonstration (input vue) Select vue.json

A brief discussion on how to configure and generate custom templates in VSCode

6. vsCode automatically generates the vue.json file as follows

A brief discussion on how to configure and generate custom templates in VSCode

7. Change the vue.json file to the following configuration (the template content can be modified according to personal needs)

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

8. Create a new vue file in the project, enter "vue" and press the Enter key or the Tab key, the template will be automatically generated

A brief discussion on how to configure and generate custom templates in VSCode

Original address: https://juejin.cn/post/6974605121942454280


Author: Sanzhu Technical Team

More programming For related knowledge, please visit:

Introduction to Programming! !

The above is the detailed content of A brief discussion on how to configure and generate custom templates in VSCode. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:掘金--三猪技术团队. If there is any infringement, please contact admin@php.cn delete