【愚公系列】2022年05月 vue3系列 配置自动打开浏览器和自动模板


一、配置自动打开浏览器

vue.config.js

module.exports = {
  devServer: {
    open: true // 是否自动启动浏览器
  }
};

在这里插入图片描述

二、自动模板

点击文件=》首选项=》代码片段=》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>

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/aa2528877987/article/details/124821875