First, command + p or ctrl + p (windows) to call up the search file box, enter vue.json, press Enter, or Preferences → User Snippets → vue.json , and then copy the following content into it.
// Place your snippets for vue here. Each snippet is defined under a snippet name and has a prefix, body and // description. 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": { // "prefix": "log", // "body": [ // "console.log('$1');", // "$2" // ], // "description": "Log output to console" // } { "Quickly generate vue template": { "prefix": "vue", "body": [ "<template>", " <div class=\"container\">", " $0", " </div>", "</template>", "", "<script>", "export default {", "components: {},", "props: {},", "data() {", "return {", " };", " },", "computed: {},", "watch: {},", "created() {},", "mounted() {},", "methods: {}", "};", "</script>", "", "<style lang=\"less\" scoped>", ".container{}", "</style>" ], "description": "A vue file template" } }
Open vscode, create a new vue file, enter vue and press Enter to automatically generate a vue template .
Reference: VSCode practical configuration and common shortcut keys
This article is reprinted from: https://chegva.com/5206.html
This site is for inclusion only, and the copyright belongs to the original author.