1、打開vscode, 文件-首選項(xiàng)-用戶代碼片段,選擇代碼片段文件或創(chuàng)建代碼片段,選擇或新建vue.json

image.png
2、輸入以下代碼:當(dāng)你輸入vue的時(shí)候,可以快速生成代碼片段
備注:配置沒有生效重啟軟件
{
"Print to console": {
"prefix": "vue",
"body": [
"<template>",
" <div>\n",
" </div>",
"</template>\n",
"<script>",
"export default {",
" props: {\n",
" },",
" components: {\n",
" },",
" data() {",
" return {\n",
" };",
" },",
" computed: {\n",
" },",
" watch: {\n",
" },",
" created() {\n",
" },",
" mounted() {\n",
" },",
" methods: {\n",
" },",
"};",
"</script>\n",
"<style scoped lang=\"${1:less}\">\n",
"</style>\n",
],
"description": "Create vue template"
}
}
3、測試:新建vue頁面,輸入vue顯示如下

image.png
看到一個(gè)更全面解釋的文章,需要可以參考一下(我沒測試)https://www.cnblogs.com/missfox18/p/11315476.html