美文网首页
使用Visual Studio Code编写Vue

使用Visual Studio Code编写Vue

作者: 伊凡的一天 | 来源:发表于2018-07-17 15:07 被阅读202次
  1. 安装Visual Studio Code
  2. 在Visual Studio Code中安装Vetur插件:Ctrl + P然后输入ext install vetur
  3. 在Visual Studio Code中安装Eslint插件:Ctrl + P然后输入ext install eslint
  4. File > Preference > Settings中的USER SETTINGS中配置:
{
  "eslint.autoFixOnSave": true,
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    {
      "language": "vue",
      "autoFix": true
    }
  ]
}
  1. 使用vue-cli新建一个vue项目(https://github.com/vuejs-templates/webpack
  2. 修改根目录下的.eslintrc.js文件(将plugin:vue/essential修改为plugin:vue/recommended):
extends: [
    // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
    // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
    'plugin:vue/recommended', 
    // https://github.com/standard/standard/blob/master/docs/RULES-en.md
    'standard'
  ],
  1. 以后JS就有错误提示了,并且直接save就能format代码啦
  2. 最后,可以在chrome中安装vue devtool插件,从而能够在chrome中查看页面的component信息。

相关文章

网友评论

      本文标题:使用Visual Studio Code编写Vue

      本文链接:https://www.haomeiwen.com/subject/fzzwpftx.html