然后打开vue.json
提示:若原本就没有vue.json,则选择 “新建全局代码片段文件”然后设置保存目录(默认的路径即可)。
打开之后将我下面的代码拷贝过去就可以(可以自定义修改)
{
"Print to v2": {
"prefix": "vue2",
"body": [
"<template>",
" <div>\n",
" </div>",
"</template>",
"<script>",
"export default {",
" data() {",
" return {\n",
" }",
" },",
" mounted(){\n",
" },",
" computed:{\n",
" },",
" methods:{\n",
" },",
"}",
"</script>",
"<style scoped>\n",
"</style>",
"$2"
],
"description": "Log output to console"
},
"Print to v3": {
"prefix": "vue3",
"body": [
"<template>",
" <div></div>",
"</template>",
"<script>",
"export default {",
" components: {\n",
" },",
" props: {\n",
" },",
" setup(props, context) {\n",
" }",
"}",
"</script>",
"<style scoped>\n",
"</style>",
],
"description": "Log output to console"
},
"Print to setup": {
"prefix": "setup",
"body": [
"<template>",
" <div></div>",
"</template>",
"<script setup>\n",
"</script>",
"<style scoped>\n",
"</style>",
],
"description": "Log output to console"
}
}
可以修改默认为 vue