使用NUXT框架搭建vue项目

697 阅读1分钟

搭建项目

确保安装了 npx(npx 在 NPM 版本 5.2.0 默认安装了)、 VueCli 、node

我推荐使用使用yarn

使用NUXT框架搭建

yarn create nuxt-app <项目名>

然后是一堆选择,

//确认项目名 回车就行
Project name: (myapp)

// 选 JS 还是 TS
Programming language: (Use arrow keys)
> JavaScript
  TypeScript
 
//选择 yarn 还是 npm
 Package manager: (Use arrow keys)
> Yarn
  Npm
  
  //选择 UI 框架  我选的 Element
   UI framework: (Use arrow keys)
> None
  Ant Design Vue
  BalmUI
  Bootstrap Vue
  Buefy
  Chakra UI
  Element
  Oruga
  Primevue
  Tachyons
  Tailwind CSS
  Windi CSS
  Vant
  View UI
  Vuetify.js
  
  // 请求方式,注意这个多选,空格 选中/取消 我选择Axios
  Nuxt.js modules: (Press <space> to select, <a> to toggle all, <i> to invert selection)
>( ) Axios - Promise based HTTP client
 ( ) Progressive Web App (PWA)
 ( ) Content - Git-based headless CMS
 
 // 代码格式化工具 ESLint + Prettier
  Linting tools: (Press <space> to select, <a> to toggle all, <i> to invert selection)
>( ) ESLint
 ( ) Prettier
 ( ) Lint staged files
 ( ) StyleLint
 ( ) Commitlint
 
 // 测试框架 我没选
 Testing framework: (Use arrow keys)
> None
  Jest
  AVA
  WebdriverIO
  Nightwatch
  
  // 服务端渲染直接选择 Universal (SSR / SSG) 
  Rendering mode: (Use arrow keys)
> Universal (SSR / SSG)
  Single Page App
  
  // 服务端语言 Server (Node.js hosting)
  Deployment target: (Use arrow keys)
> Server (Node.js hosting)
  Static (Static/Jamstack hosting)
  
  // 不知道干嘛的没选 不用TS可以选jsconfig.json
  Development tools: (Press <space> to select, <a> to toggle all, <i> to invert selection)
>( ) jsconfig.json (Recommended for VS Code if you're not using typescript)
 ( ) Semantic Pull Requests
 ( ) Dependabot (For auto-updating dependencies, GitHub only)
 
 // 不知道干嘛的没选
 Continuous integration: (Use arrow keys)
> None
  GitHub Actions (GitHub only)
  Travis CI
  CircleCI
  
 // 代码管理 git
 Version control system: (Use arrow keys)
> Git
  None
  
 然后就搭建成功了
 
 Successfully created project ceshi

  To get started:

        cd ceshi
        yarn dev

  To build & start for production:

        cd ceshi
        yarn build
        yarn start
        

进入项目 yarn dev 跑起来