docs: show how to create a project with template (#533)

This commit is contained in:
ElderJames 2020-08-25 12:42:02 +08:00
parent 07747546ce
commit 6bb3025a40
4 changed files with 96 additions and 16 deletions

View File

@ -69,16 +69,36 @@ WebAssembly 静态托管页面示例
- 先安装 [.NET Core SDK](https://dotnet.microsoft.com/download/dotnet-core/3.1) 3.1.300 以上版本
- 创建 Blazor WebAssembly 项目
### 从模板创建一个新项目
我们提供了 `dotnet new` 模板来创建一个开箱即用的 [Ant Design Pro](https://github.com/ant-design-blazor/ant-design-pro-blazor) 新项目:
- 安装模板
```bash
$ dotnet new blazorwasm -o MyAntDesignApp
$ dotnet new --install AntDesign.Templates::0.1.0-*
```
- 从模板创建 Ant Design Blazor Pro 项目
```bash
$ dotnet new antdesign -o MyAntDesignApp
```
模板的参数:
| 参数 | 说明 | 类型 | 认 值 |
| ---------------- | -------------------------------------------- | ------------- | --------- |
| `-f` \| `--full` | 如果设置这个参数,会生成所有 Ant Design Pro 页面 | bool | false |
| `-ho` \| `--host` | 指定托管模型 | 'wasm' \| 'server' \| 'hosted' | 'wasm' |
| `--no-restore` | 如果设置这个参数,就不会自动恢复包引用 | bool | false |
### 在已有项目中引入 Ant Design Blazor
- 进入应用的项目文件夹,安装 Nuget 包引用
```bash
$ cd MyAntDesignApp
$ dotnet add package AntDesign --version
```
@ -88,7 +108,7 @@ WebAssembly 静态托管页面示例
services.AddAntDesign();
```
- 在 `wwwroot/index.html`(WebAssembly) 或 `Pages/_Host.razor`(Server) 中引入静态文件:
- 在 `wwwroot/index.html`(WebAssembly) 或 `Pages/_Host.cshtml`(Server) 中引入静态文件:
```html
<link href="_content/AntDesign/css/ant-design-blazor.css" rel="stylesheet" />

View File

@ -69,16 +69,36 @@ Regularly synchronize with Official Ant Design specifications, you can check the
- Install [.NET Core SDK](https://dotnet.microsoft.com/download/dotnet-core/3.1) 3.1.300 or later
- Create Blazor WebAssembly Project
### Create a new project from the dotnet new template
We have provided the `dotnet new` template to create a [Boilerplate](https://github.com/ant-design-blazor/ant-design-pro-blazor) project out of the box
- Install the template
```bash
$ dotnet new blazorwasm -o MyAntDesignApp
$ dotnet new --install AntDesign.Templates::0.1.0-*
```
- Create the Boilerplate project with the template
```bash
$ dotnet new antdesign -o MyAntDesignApp
```
Options for the template
| Options | Description | Type | Default |
| ---------------- | -------------------------------------------- | ------ | --------- |
| `-f` \| `--full` | If specified, generates all pages of Ant Design Pro | bool | false |
| `-ho` \| `--host` | Specify the hosting model | 'wasm' \| 'server' \| 'hosted' | 'wasm' |
| `--no-restore` | If specified, skips the automatic restore of the project on create | bool | false |
### Import Ant Design Blazor into an existing project
- Go to the project folder of the application and install the Nuget package reference
```bash
$ cd MyAntDesignApp
$ dotnet add package AntDesign
```
@ -88,7 +108,7 @@ Regularly synchronize with Official Ant Design specifications, you can check the
services.AddAntDesign();
```
- Link the static files in `wwwroot/index.html` (WebAssembly) or `Pages/_Host.razor` (Server)
- Link the static files in `wwwroot/index.html` (WebAssembly) or `Pages/_Host.cshtml` (Server)
```html
<link href="_content/AntDesign/css/ant-design-blazor.css" rel="stylesheet" />

View File

@ -68,16 +68,37 @@ Regularly synchronize with Official Ant Design specifications, you can check the
- Install [.NET Core SDK](https://dotnet.microsoft.com/download/dotnet-core/3.1) 3.1.300 or later
- Create Blazor WebAssembly Project
### Create a new project from the dotnet new template
We have provided the `dotnet new` template to create a [Boilerplate](https://github.com/ant-design-blazor/ant-design-pro-blazor) project out of the box
- Install the template
```bash
$ dotnet new blazorwasm -o MyAntDesignApp
$ dotnet new --install AntDesign.Templates::0.1.0-*
```
- Create the Boilerplate project with the template
```bash
$ dotnet new antdesign -o MyAntDesignApp
```
Options for the template
| Options | Description | Type | Default |
| ---------------- | -------------------------------------------- | ------ | --------- |
| `-f` \| `--full` | If specified, generates all pages of ant design pro | bool | false |
| `-ho` \| `--host` | Specify the hosting model | 'wasm' \| 'server' \| 'hosted' |'wasm' |
| `--no-restore` | If specified, skips the automatic restore of the project on create | bool | false |
### Import Ant Design Blazor into an existing project
- Go to the project folder of the application and install the Nuget package reference
```bash
$ cd MyAntDesignApp
$ dotnet add package AntDesign --version 0.1.0-*
```
@ -87,7 +108,7 @@ Regularly synchronize with Official Ant Design specifications, you can check the
services.AddAntDesign();
```
- Link the static files in `wwwroot/index.html` (WebAssembly) or `Pages/_Host.razor` (Server)
- Link the static files in `wwwroot/index.html` (WebAssembly) or `Pages/_Host.cshtml` (Server)
```html
<link href="_content/AntDesign/css/ant-design-blazor.css" rel="stylesheet" />

View File

@ -66,16 +66,35 @@ title: Ant Design of Blazor
- 先安装 [.NET Core SDK](https://dotnet.microsoft.com/download/dotnet-core/3.1) 3.1.300 以上版本
- 创建 Blazor WebAssembly 项目
### 从模板创建一个新项目
我们提供了 `dotnet new` 模板来创建一个开箱即用的 [Ant Design Pro](https://github.com/ant-design-blazor/ant-design-pro-blazor) 新项目:
- 安装模板
```bash
$ dotnet new --install AntDesign.Templates::0.1.0-*
```
$ dotnet new blazorwasm -o MyAntDesignApp
- 从模板创建 Ant Design Blazor Pro 项目
```bash
$ dotnet new antdesign -o MyAntDesignApp
```
模板的参数:
| 参数 | 说明 | 类型 | 认 值 |
| ---------------- | -------------------------------------------- | ------------- | --------- |
| `-f` \| `--full` | 如果设置这个参数,会生成所有 Ant Design Pro 页面 | bool | false |
| `-ho` \| `--host` | 指定托管模型 | 'wasm' \| 'server' \| 'hosted' | 'wasm' |
| `--no-restore` | 如果设置这个参数,就不会自动恢复包引用 | bool | false |
### 在已有项目中引入 Ant Design Blazor
- 进入应用的项目文件夹,安装 Nuget 包引用
```bash
$ cd MyAntDesignApp
$ dotnet add package AntDesign --version 0.1.0-*
```
@ -85,7 +104,7 @@ title: Ant Design of Blazor
services.AddAntDesign();
```
- 在 `wwwroot/index.html`(WebAssembly) 或 `Pages/_Host.razor`(Server) 中引入静态文件:
- 在 `wwwroot/index.html`(WebAssembly) 或 `Pages/_Host.cshtml`(Server) 中引入静态文件:
```
<link href="_content/AntDesign/css/ant-design-blazor.css" rel="stylesheet">