1.根据图示,选择用户代码片段
2.向弹出的搜索框中搜索vue.json并点击打开vue.json文件
3.向Vue.json中添加下列内容(你也可以根据下面的代码进行自定义)
"Print to console": {
"prefix": "vue",
"body": [
"<!--- $1 --->",
"<style lang = '$2' scoped>",
"",
"</style>",
"",
"<template>",
" <div>",
"$3",
" </div>",
"</template>",
"",
"<script>",
"export default {",
" data () {",
" return {",
"",
" }",
" },",
" methods: {",
"",
" },",
" // 生命周期 - 创建完成",
" created () {",
"",
" },",
"",
" // DOM挂载完毕",
" mounted () {",
"",
" }",
"}",
"</script>",
""
]
},
"vue代码": {
"prefix": "ve",
"body": [
"<!DOCTYPE html>",
"",
"<html lang='en'>",
"<head>",
"\t<meta charset=\"UTF-8\">",
"\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">",
"\t<meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">",
"\t<title>Document</title>",
"\t<script src=\"../node_modules/vue/dist/vue.min.js\"></script>",
"</head>",
"",
"<body>",
"\t<div class=\"container\">",
"\t</div>",
"\t<script>",
" \t\tvar vue = new Vue({",
"\t\t\tel : '.container',",
"\t\t\tdata : { }," ,
"\t\t\tmethods : { }" ,
"\t\t});",
"\t</script>",
"</body>",
"",
"</html>",
""
]
}
注意:
1.prefix指定你要插入代码片段需要输入什么简写的代码才能插入,比如我上面指定的是ve和vue我们,便可以按ve或者vue,然后tab键便能插入对应的代码片段。
2.单页面中的$1 $2 表示创建光标的位置,可按Tab切换位置,prefix的名字可随意更改