安装

# 两种方式
# 1.nuxt 脚手架工具(create-nuxt-app)安装 
npx create-nuxt-app <项目名称>
yarn create nuxt-app <项目名称>
yarn create nuxt-app . (./)
# 2.vue 脚手架工具安装

安装过程

  1. Project name

  2. Programming language:(js ts)

  3. Package manager: (Yarn Npm)

  4. UI framework:

  5. Nuxt.js modules:

    Axios
    PWA (Progressive Web App) --Project/PWA.md
    Content @nustjs/content
    @nustjs/content 主要是将content 下面 Markdown,JSON,YAML,CSV 文档生成 MongoDB 形式的API, 内容资料库。
    
  6. Linting tools:

    ESlint
    // ESLint 是在 ECMAScript/JavaScript 代码中识别和报告模式匹配的工具,它的目标是保证代码的一致性和避免错误。
    Stylelint
    // stylelint是现在最强大的css代码审查工具,由PostCSS提供技术支持。
    Prettier
    // Prettier是最近很火的一个代码美化工具 代码格式化
    List staged files
    // lint-staged 是一个在git暂存文件上运行linters的工具
    Commitlint
    // 提交信息规范
    
    
  7. Testing fremework 自动化测试

  8. Rendering mode:

    > Universal (SSR / SSG)
      SPA (Single Page App)
    
  9. Deployment target:

    > Server (Node.js hosting)
      Static (Static/JA?Stack hosting)
    
  10. Development tool

    > jsconfig.json (Recommended for VS Code if you're not using typescript)
      Semantic Pull Requests
      Dependabot(For auto-updating dependencies, GitHub only)
    
    
  11. Continuous integration:

    > None
      GitHub Actions (GitHub only)
    
  12. Version control system: Git

后续安装

less less-loader
eslint-config-airbnb-base // eslint
cross-env
@nuxtjs/style-resources // 加载静态资源

jsoncnfig.json

通过jsconfig.json文件定义一个JavaScript项目。目录中是否存在此类文件表示该目录是JavaScript项目的根目录。文件本身可以选择列出属于项目的文件,要从项目中排除的文件以及编译器选项。

.vscode -> settings.json

{
    // 保存时eslint自动修复错误
    "eslint.autoFixOnSave": true,
    "editor.formatOnSave": true,
    "eslint.validate": [
        'javascript',
        'javascriptreact',
        {
            "language": 'vue',
            "autoFix": true
        },
        {
            "language": 'typescript',
            "autoFix": true
        }
    ],
    "files.autoSave": "onWindowChange",
    "editor.codeActionsOnSave": {
        "source.fixAll.eslint": true
    },
    "editor.wordWrap": "wordWrapColumn",
    "editor.wordWrapColumn": 150
}