Home > Development Tools > VSCode > body text

Some necessary vscode plug-ins for developing vue items

青灯夜游
Release: 2021-02-03 18:52:57
forward
7753 people have browsed it

Some necessary vscode plug-ins for developing vue items

相关推荐:《vscode教程

开发vue项目的一些vscode必备插件

  • Eslint
    检查代码是否符合规范

  • GitLens
    Git提示

  • language-stylus
    stylus语法支持

  • Path Intellisense
    相对、绝对路径提示

  • Prettier formatter
    代码格式化

  • Vetur
    Vue语法支持。包括语法高亮、语法代码提示、语法lint检测等

  • Vue VSCode Snippets
    Vue 语法片段扩展

  • npm Intellisense
    import、require npm模块是自动补全

  • Auto Close Tag
    自动闭合HTML/XML标签

  • Auto Rename Tag
    自动完成另一侧标签的同步修改

  • JavaScript(ES6) code snippets
    ES6语法智能提示以及快速输入,除js外还支持.ts,.jsx,.tsx,.html,.vue,省去了配置其支持各种包含js代码文件的时间

  • HTML CSS Support
    让 html 标签上写class 智能提示当前项目所支持的样式

  • Bracket Pair Colorizer
    给括号加上不同的颜色,便于区分不同的区块,使用者可以定义不同括号类型和不同颜色

VSCode 初次写vue项目并一键生成.vue模版

文件–>首选项–>用户代码片段–>搜索vue.json文件打开

  • 打开之后删除里面的代码复制下面的代码
{
	"Print to console": {
		"prefix": "vue",
		"body": [
			"<!-- $1 -->",
			"<template>",
			"<p class=&#39;$2&#39;>$5</p>",
			"</template>",
			"",
			"<script>",
			"//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)",
			"//例如:import 《组件名称》 from '《组件路径》';",
			"",
			"export default {",
			"//import引入的组件需要注入到对象中才能使用",
			"components: {},",
			"data() {",
			"//这里存放数据",
			"return {",
			"",
			"};",
			"},",
			"//监听属性 类似于data概念",
			"computed: {},",
			"//监控data中的数据变化",
			"watch: {},",
			"//方法集合",
			"methods: {",
			"",
			"},",
			"//生命周期 - 创建完成(可以访问当前this实例)",
			"created() {",
			"",
			"},",
			"//生命周期 - 挂载完成(可以访问DOM元素)",
			"mounted() {",
			"",
			"},",
			"beforeCreate() {}, //生命周期 - 创建之前",
			"beforeMount() {}, //生命周期 - 挂载之前",
			"beforeUpdate() {}, //生命周期 - 更新之前",
			"updated() {}, //生命周期 - 更新之后",
			"beforeDestroy() {}, //生命周期 - 销毁之前",
			"destroyed() {}, //生命周期 - 销毁完成",
			"activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发",
			"}",
			"</script>",
			"<style lang=&#39;less&#39; scoped>",
			"//@import url($3); 引入公共css类",
			"$4",
			"</style>"
		],
		"description": "Log output to console"
	}
}
Copy after login
  • ps:如果没安装less 运行时会报错

vue安装less

npm install less less-loader --save-dev
# cli3以上不需配置任何东西
# 更改配置文件build/webpack.base.conf.js
# cli3以下需要配置
rules: [
            //  此处省略无数行,已有的的其他的规则
            {
              test: /\.less$/,
              loader: "style-loader!css-loader!less-loader"
            }
         ]
Copy after login

此时新建.vue文件 输入vue 按键盘的tab就行

更多编程相关知识,请访问:编程入门!!

The above is the detailed content of Some necessary vscode plug-ins for developing vue items. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template