网站开发售后服务能力,哪些网站适合新手编程做项目,外贸新手入门必读,网站制作论文题目VS新建vue文件的自定义模板
在使用vscode开发的时候#xff0c;新建vue文件是不可或缺的#xff0c;但是VSCode并没有vue文件的初始化模板#xff0c;这个需要自定义模板。 我们可以使用vscode的snippets在新建.vue 文件后轻松获得一套模板。
具体步骤
打开VSCode - …VS新建vue文件的自定义模板
在使用vscode开发的时候新建vue文件是不可或缺的但是VSCode并没有vue文件的初始化模板这个需要自定义模板。 我们可以使用vscode的snippets在新建.vue 文件后轻松获得一套模板。
具体步骤
打开VSCode - “文件mac机选Code” - “首选项” - 用户代码片段”然后会打开一个弹框。在弹框中选择新建代码片段新建一个全局代码片段文件自定义名称保存后VS编辑器就会打开这个文件。然后复制以下内容覆盖文件内容。
{// 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// }Create vue template: {prefix: vue,body: [template, div/div,/template,script,export default {, name: \${1:component_name}\,, data () {, return {}, },, methods:{},},/script,style lang\${2:scss}\ scoped,/style],description: Create vue template}
}prefix 表示对应生成代码块的命令我设置的是vue 然后将文件保存关闭。
然后新建一个.vue文件 在新建的.vue的文件中输入vue回车然后就会生成初始化代码块。生成初始化模板如图 具体参数可以根据实际修改此处我是用的是scss预处理语言
注意
步骤二还有一个方法方法二 在弹框中搜索vue选中vue.json在vue.json中编辑自定义模板
新建全局代码片段的好处就是在非vue文件中输入vue命令都能新建出vue初始化代码模板。如果是vue.json文件中定义初始化代码模板的话就只能在.vue文件中vue命令才会有效。