快速创建vue2代码片段
首先安装vscode,可以去官网或者电脑应用商店自行下载 ( 例如联想电脑:联想应用商店 )
[vscode官网]: code.visualstudio.com/Download
选择对应系统的版本,进行安装
1、打开vscode编辑器 找到左下角设置
2、点开设置-->用户代码片段
3、点开设置-->用户代码片段-->选择新建代码片段
4、选择新代码片段,输入下面的代码再进行保存,就可以新建vue页面输入"vue",按下回车或者tab键进行创建模板
提示:prefix:是选择创建命令,description:是方便识别此代码片段的作用
{
// 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"
// }
"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"
}
}