Skip to content

Commit 1fca05e

Browse files
HomWangatinux
authored andcommitted
Nuxt 2.0 install (nuxt#802)
Nuxt.js install create-nuxt-app Use a tutorial
1 parent 2d8c426 commit 1fca05e

File tree

1 file changed

+38
-16
lines changed

1 file changed

+38
-16
lines changed

zh/guide/installation.md

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,58 @@
11
---
2-
title: 安装
2+
安装
33
description: Nuxt.js 十分简单易用。一个简单的项目只需将 `nuxt` 添加为依赖组件即可。
44
---
55

66
> Nuxt.js 十分简单易用。一个简单的项目只需将 `nuxt` 添加为依赖组件即可。
77
8-
## 新手模板
8+
## 运行 create-nuxt-app
99

10-
为了便于大家快速使用,Nuxt.js提供了一个 [starter 模板](https://github.com/nuxt-community/starter-template)
10+
为了快速入门,Nuxt.js团队创建了脚手架工具 [create-nuxt-app](https://github.com/nuxt/create-nuxt-app)
1111

12-
[下载模板的压缩包](https://github.com/nuxt-community/starter-template/archive/master.zip) 或利用 `vue-cli` 安装使用
12+
确保安装了npx(npx在NPM版本5.2.0默认安装了)
1313

1414
```bash
15-
$ vue init nuxt-community/starter-template <project-name>
15+
$ npx create-nuxt-app <项目名>
1616
```
1717

18-
> 如果 [Vue CLI](https://github.com/vuejs/vue-cli) 没有安装, 需先通过 `npm install -g @vue/cli @vue/cli-init` 来安装。
19-
20-
然后安装依赖包:
18+
或者用yarn :
2119

2220
```bash
23-
$ cd <project-name>
24-
$ npm install
21+
$ yarn create-nuxt-app <项目名>
2522
```
2623

27-
接着通过以下命令启动项目:
24+
它会让你进行一些选择:
25+
26+
1. 在集成的服务器端框架之间进行选择:
27+
- None (Nuxt默认服务器)
28+
- [Express](https://github.com/expressjs/express)
29+
- [Koa](https://github.com/koajs/koa)
30+
- [Hapi](https://github.com/hapijs/hapi)
31+
- [Feathers](https://github.com/feathersjs/feathers)
32+
- [Micro](https://github.com/zeit/micro)
33+
- [Adonis](https://github.com/adonisjs/adonis-framework) (WIP)
34+
2. 选择您喜欢的UI框架:
35+
- None (无)
36+
- [Bootstrap](https://github.com/bootstrap-vue/bootstrap-vue)
37+
- [Vuetify](https://github.com/vuetifyjs/vuetify)
38+
- [Bulma](https://github.com/jgthms/bulma)
39+
- [Tailwind](https://github.com/tailwindcss/tailwindcss)
40+
- [Element UI](https://github.com/ElemeFE/element)
41+
- [Buefy](https://buefy.github.io)
42+
3. 选择你想要的Nuxt模式 (`Universal` or `SPA`)
43+
4. 添加 [axios module](https://github.com/nuxt-community/axios-module) 以轻松地将HTTP请求发送到您的应用程序中。
44+
5. 添加 [EsLint](https://eslint.org/) 以在保存时代码规范和错误检查您的代码。
45+
5. 添加 [Prettier](https://prettier.io/) 以在保存时格式化/美化您的代码。
46+
47+
当运行完时,它将安装所有依赖项,因此下一步是启动项目:
48+
2849
```bash
2950
$ npm run dev
3051
```
31-
应用现在运行在 http://localhost:3000
3252

33-
<p class="Alert">注意:Nuxt.js 会监听 `pages` 目录中的文件变更并自动重启, 当添加新页面时没有必要手工重启应用。</p>
53+
应用现在运行在 http://localhost:3000 上运行。
54+
55+
<p class="Alert">注意:Nuxt.js 会监听 `pages` 目录中的文件更改,因此在添加新页面时无需重新启动应用程序。</p>
3456

3557
了解模板项目的目录结构: [目录结构](/guide/directory-structure)
3658

@@ -43,7 +65,7 @@ $ mkdir <项目名>
4365
$ cd <项目名>
4466
```
4567

46-
*提示: 将 项目名 替换成为你想创建的实际项目名*
68+
<p class="Alert Alert--nuxt-green"><b>提示:</b><code>&lt;项目名&gt;</nom-du-projet></code> 替换成为你想创建的实际项目名。</p>
4769

4870
### 新建 package.json 文件
4971

@@ -85,8 +107,8 @@ $ mkdir pages
85107
```bash
86108
$ npm run dev
87109
```
88-
Bingo!现在我们的应用运行在 http://localhost:3000
110+
现在我们的应用运行在 http://localhost:3000 上运行。
89111

90-
<p class="Alert">注意:Nuxt.js 会监听 `pages` 目录中的文件变更并自动重启, 当添加新页面时没有必要手工重启应用。</p>
112+
<p class="Alert">注意:Nuxt.js 会监听 `pages` 目录中的文件更改,因此在添加新页面时无需重新启动应用程序。</p>
91113

92114
了解更多关于Nuxt.js应用的目录结构: [目录结构](/guide/directory-structure)

0 commit comments

Comments
 (0)