Skip to content

Commit 62639b2

Browse files
committed
add doc
1 parent 2b81a51 commit 62639b2

File tree

6 files changed

+111
-8
lines changed

6 files changed

+111
-8
lines changed

docs/Build Command.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# 构建命令
2+
```bash
3+
# 开发模式
4+
npm run dev
5+
6+
# 构建开发环境
7+
npm run build:dev
8+
9+
# 构建 sit 环境
10+
npm run build:sit
11+
12+
# 构建 deploy 环境
13+
npm run deploy
14+
15+
# 生成 svg 图标
16+
npm run svg
17+
18+
```
19+
20+
## 添加组件
21+
使用 **./tools/cli.js** 添加组件。
22+
```text
23+
选项:
24+
--version, -v 显示版本号 [布尔]
25+
--help, -h 显示帮助信息 [布尔]
26+
--type, -t The component type
27+
[可选值: "view", "ui", "tag"] [默认值: "view"]
28+
--path, -p The target path [默认值: "src/components"]
29+
```
30+
```bash
31+
# 添加组件,
32+
./tools/cli.js add [componentName] -t [componentType]
33+
34+
# 如果只是添加 view, 而且已经安装 yarn
35+
yarn cli add [componentName] -t [componentType]
36+
```
37+
38+
componentName 可以是路径
39+
```bash
40+
./tools/cli.js add public/login -t view
41+
```
42+
以上会在 src/components/views/public/login 创建一个 view 类型的组件。
43+
#####
44+
**-p** 参数是指定根路径。如果你要创建的组件不在 **src/components**, 你可以通过设置该参数改变根路径。
45+
46+
```bash
47+
./tools/cli.js add hello -t tag -p demo/components
48+
```
49+
以上会在 demo/components/tags/hello 创建一个 tag 类型的组件。

docs/Project Structure.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Project Structure
2+
```text
3+
.
4+
├── build # 项目构建配置目录
5+
│   ├── config # 开发模式和生产模式配置
6+
│   │   ├── index.js
7+
│   ├── tpl # html 模板
8+
│   │   └── index.html
9+
│   └── ...
10+
├── src
11+
│   ├── api # 后端接口配置
12+
│   │   ├── http.ts
13+
│   │   ├── index.ts
14+
│   │   └── modules # 后端接口模块
15+
│   │   └── ...
16+
│   ├── assets # module assets (processed by webpack)
17+
│   │   └── svg # 存放 svg 图标源文件
18+
│   │   └── ...
19+
│   ├── components # 组件
20+
│   │   ├── base.ts # 组件基类,所有组件继承自它
21+
│   │   ├── icons # 生产的 svg 图标
22+
│   │   ├── pages # 页面级组件
23+
│   │   ├── tags # 全局组件 (自定义标签)
24+
│   │   └── views # 视图级组件
25+
│   ├── env # 坏境配置
26+
│   ├── main.ts # 入口文件
27+
│   ├── router # 路由
28+
│   ├── store # vuex store
29+
│   │   ├── modules # vuex 模块
30+
│   │   └── utils # vuex 辅助
31+
│   └── style # 样式
32+
├── static # pure static assets (directly copied)
33+
├── tools # 工具,比如用来创建组件
34+
└── typings # 类型定义文件
35+
│   ├── globals.d.ts # 全局类型定义
36+
│   └── interface # 接口定义
37+
├── tsconfig.json # typescript 配置
38+
├── tslint.json # typescript 格式检查
39+
├── .editorconfig # 编辑器格式配置
40+
├── .npmrc # npm 配置
41+
├── .postcssrc.js # postcss 配置
42+
├── .stylelintrc.js # 样式检查
43+
```

docs/README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,13 @@
1-
# hello
2-
hello gitbook
1+
# 简介
2+
vue-typescript 是在 [vuejs-templates/webpack](https://github.com/vuejs-templates/webpack) 的基础上修改的,主要是将开发语言从 ES6 改成 Typescript。使用本模板之前,建议看一下 [vuejs-templates/webpack 的文档](http://vuejs-templates.github.io/webpack/)
3+
4+
## 开始
5+
使用该模板,请先安装 [vue-cli](https://github.com/vuejs/vue-cli)
6+
7+
```bash
8+
npm install vue-cli -g
9+
vue init MMF-FE/vue-typescript my-project
10+
cd my-project
11+
npm install
12+
npm run dev
13+
```

docs/SUMMARY.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Summary
22

3-
* [Introduction](README.md)
3+
* [简介](README.md)
4+
* [项目结构](Project Structure.md)
5+
* [构建命令](Build Command.md)
46

docs/hello.md

Lines changed: 0 additions & 2 deletions
This file was deleted.

template/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"main": "index.js",
66
"scripts": {
77
"dev": "ENV=dev node build/dev-server.js",
8-
"dev-build": "ENV=dev node build/build.js",
9-
"sit": "ENV=sit node build/build.js",
10-
"deploy": "ENV=deploy node build/build.js",
8+
"build:dev": "ENV=dev node build/build.js",
9+
"build:sit": "ENV=sit node build/build.js",
10+
"build:deploy": "ENV=deploy node build/build.js",
1111
"svg": "vsvg -s ./src/assets/svg -t ./src/components/icons",
1212
"cli": "node ./tools/cli.js"
1313
},

0 commit comments

Comments
 (0)