文章目录
- 一、配置自动打开浏览器
- 二、自动模板
一、配置自动打开浏览器
vue.config.js
module.exports = {
devServer: {
open: true // 是否自动启动浏览器
},
lintOnSave: false,//禁止eslink
};
二、自动模板
点击文件=》首选项=》代码片段=》vue.json
{
// Place your snippets for vue-html 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 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文件中输入vue就会选项
选择vue3出现下面代码片段
<template>
<div></div>
</template>
<script>
export default {
components: {
},
props: {
},
setup(props, context) {
}
}
</script>
<style scoped>
</style>
文章目录
- 一、配置自动打开浏览器
- 二、自动模板
一、配置自动打开浏览器
vue.config.js
module.exports = {
devServer: {
open: true // 是否自动启动浏览器
},
lintOnSave: false,//禁止eslink
};
二、自动模板
点击文件=》首选项=》代码片段=》vue.json
{
// Place your snippets for vue-html 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 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文件中输入vue就会选项
选择vue3出现下面代码片段
<template>
<div></div>
</template>
<script>
export default {
components: {
},
props: {
},
setup(props, context) {
}
}
</script>
<style scoped>
</style>