Skip to content

Commit

Permalink
docs: 更新文档
Browse files Browse the repository at this point in the history
  • Loading branch information
Nice-PLQ authored May 23, 2023
1 parent 4ea4df4 commit 104e585
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 39 deletions.
14 changes: 7 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

### 介绍

首先感谢你关注 vion 组件库,并进行代码贡献。
以下是关于向 vion 提交代码的指南。在向 vion 提交 Issue 或者 MR 之前,请先花几分钟时间阅读以下文字
首先感谢你关注 Vion 组件库,并进行代码贡献。
以下是关于向 Vion 提交代码的指南。在向 Vion 提交 Issue 或者 MR 之前,请先花几分钟时间阅读以下文字

### Issue 规范

Expand Down Expand Up @@ -33,7 +33,6 @@
- 新增组件特性,分支命名形式为 **feature/[组件名]\_[功能]**,如:`feature/button_loading`
3. 在新分支上开发完成后,提 Merge Request 到仓库的 dev 分支
4. Merge Request 会在 Review 通过后被合并到仓库 Master 分支
5. 周知负责人发布版本,可以直接联系`linkpan`

### 目录结构

Expand All @@ -59,18 +58,19 @@
```
src
|- button
| ├─ __test__ # 单元测试
| ├─ demo # 示例代码
| ├─ test # 单元测试
| ├─ button.vue # 组件源码
| ├─ button.vue # 组件源码
| ├─ index.js # 组件入口
| ├─ style.js # 样式入口
| ├─ README.md # 中文文档
| ├─ README.md # 组件文档
|
|- style
| ├─ button.less # 组件样式
|
├─ index.js # 所有组件入口
└─ index.less # 所有组件样式
├─ index-es.js # ESM组件入口
├─ config.js # 配置文件
```

### 关于相关命名规范
Expand Down
14 changes: 7 additions & 7 deletions docs/contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

### 介绍

首先感谢你关注 vion 组件库,并进行代码贡献。
以下是关于向 vion 提交代码的指南。在向 vion 提交 Issue 或者 MR 之前,请先花几分钟时间阅读以下文字
首先感谢你关注 Vion 组件库,并进行代码贡献。
以下是关于向 Vion 提交代码的指南。在向 Vion 提交 Issue 或者 MR 之前,请先花几分钟时间阅读以下文字

### Issue 规范

Expand Down Expand Up @@ -33,27 +33,27 @@
- 新增组件特性,分支命名形式为 **feature/[组件名]\_[功能]**,如:`feature/button_loading`
3. 在新分支上开发完成后,提 Merge Request 到仓库的 dev 分支
4. Merge Request 会在 Review 通过后被合并到仓库 Master 分支
5. 周知负责人发布版本,可以直接联系`linkpan`

### 目录结构

- 仓库的组件代码位于 src 下,每个组件一个文件夹
- site 目录下是文档网站的代码,本地查看网站效果时可以在目录下运行 `npm run dev:docs && npm run dev:demo` 开启文档网站
- site 目录下是文档网站的代码,本地查看网站效果时可以在目录下运行 `npm run dev` 开启文档网站

项目目录大致如下:

```
vion
├─ build # 构建
├─ script # 构建脚本
├─ lib # 产物
├─ es # ESM产物
├─ docs # 文档
├─ src # 组件
├─ site # 网站
├─ types # 类型定义
```

### 添加新组件

添加新组件时,请按照下面的目录结构组织文件,并在 site/[demo|docs]/config.js 中配置组件名称及相关信息。运行`npm run dev:demo`即可以打开浏览器查看组件示例了。访问地址[http://localhost:8899/#/button](http://localhost:8899/#/button)
添加新组件时,请按照下面的目录结构组织文件,并在 site/[demo|docs]/config.js 中配置组件名称及相关信息。运行`npm run dev`即可以打开浏览器查看组件示例了。

```
src
Expand Down
10 changes: 5 additions & 5 deletions docs/i18n.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# 国际化

vion 默认采用中文语言,如果需要切换其他语言,请参考如下
Vion 默认采用中文语言,如果需要切换其他语言,请参考如下

### 1、切换语言

vion 通过 Locale 组件实现多语言支持,使用`Locale.use`方法切换语言环境,比如切换到英文环境
Vion 通过 Locale 组件实现多语言支持,使用`Locale.use`方法切换语言环境,比如切换到英文环境

```js
// 按需引入
Expand All @@ -25,12 +25,12 @@ createApp()
```js
// 全量引入Vion
import { createApp } from "vue";
import vion from "vion";
import Vion from "vion";
import messages from "vion/es/locale/lang/en-US";

vion.Locale.use("en-US", messages);

createApp().use(vion);
createApp().use(Vion);
```

### 2、语言包
Expand All @@ -42,7 +42,7 @@ createApp().use(vion);
- 英语(en-US)
- 日语(ja-JP)

如果不能满足业务场景,只需要按照[语言包格式](https://git.woa.com/q-ui/q-ui/blob/feature/locale/src/locale/lang/zh-CN.js)自定义语言,然后使用`Locale`组件加载即可,如:
如果不能满足业务场景,只需要按照[语言包格式](https://github.com/Nice-PLQ/vion/blob/master/src/locale/lang/zh-CN.js)自定义语言,然后使用`Locale`组件加载即可,如:

```js
import messages from "./lang/fr-FR"; // 自定义的【法语】语言包
Expand Down
10 changes: 0 additions & 10 deletions site/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
"label": "起步",
"type": 1
},
{
"name": "color",
"label": "色彩",
"type": 1
},
{
"name": "i18n",
"label": "国际化",
Expand All @@ -34,11 +29,6 @@
"label": "组件",
"name": "components",
"children": [
{
"name": "Avatar",
"label": "头像",
"type": 2
},
{
"name": "ActionSheet",
"label": "动作面板",
Expand Down
20 changes: 10 additions & 10 deletions site/docs/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ export default [
label: '起步',
component: () => import('@docs/intro.md'),
},
{
name: 'color',
label: '色彩',
component: () => import('./components/Colors/index.vue'),
},
// {
// name: 'color',
// label: '色彩',
// component: () => import('./components/Colors/index.vue'),
// },
{
name: 'i18n',
label: '国际化',
Expand All @@ -24,11 +24,11 @@ export default [
label: '贡献代码',
component: () => import('@docs/contribute.md'),
},
{
name: 'Avatar',
label: '头像',
component: () => import('@/avatar/README.md'),
},
// {
// name: 'Avatar',
// label: '头像',
// component: () => import('@/avatar/README.md'),
// },
{
name: 'ActionSheet',
label: '动作面板',
Expand Down

0 comments on commit 104e585

Please sign in to comment.