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

编程知识 更新时间:2023-04-22 10:39:22

文章目录

  • 一、配置自动打开浏览器
  • 二、自动模板


一、配置自动打开浏览器

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>

更多推荐

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

本文发布于:2023-04-17 02:16:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/b8f323bd7e35238b2225938eaa46ba13.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:愚公   系列   模板   打开浏览器

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!

  • 82131文章数
  • 6651阅读数
  • 0评论数