mirror of
https://github.com/youzan/vant.git
synced 2025-12-24 02:02:09 +08:00
[Improvement] Reorganize demos (#1052)
This commit is contained in:
6
.github/CONTRIBUTING.zh-CN.md
vendored
6
.github/CONTRIBUTING.zh-CN.md
vendored
@@ -48,7 +48,7 @@ vant
|
||||
|
||||
- 添加 Vue 代码
|
||||
|
||||
以添加新组件 `Button` 为例,首先在 `packages` 目录下新建目录 `button`,用 `index.js` 或者 `index.vue` 文件做为组件入口,需要的话可以建其他文件来组织代码。
|
||||
以添加新组件 `Button` 为例,首先在 `packages` 目录下新建目录 `button`,用 `index.js` 或者 `index.vue` 文件做为组件入口,需要的话可以建其他文件来组织代码。测试代码放在组件目录下的 `test` 文件夹中,示例代码放在组件目录下的 `demo` 文件夹中。
|
||||
|
||||
- 添加样式代码
|
||||
|
||||
@@ -60,10 +60,6 @@ vant
|
||||
|
||||
新组件的文档编写,需要在 `docs/markdown` 下各个语言中新建对应同名文档 `button.md`,在 `docs/demos` 下创建组件示例,并在 `docs/src/doc.config.js` 中进行配置组件名称
|
||||
|
||||
- 添加测试代码
|
||||
|
||||
需要在 `test/specs` 目录下增加对应组件的测试文件,以 .spec.js 结尾,如:`button.spec.js`。测试框架使用了 karma + mocha + sinon + chai,vue 相关的操作使用了 [avoriaz](https://github.com/eddyerburgh/avoriaz)
|
||||
|
||||
|
||||
## 组件文档如何编写
|
||||
|
||||
|
||||
3
.github/MARKDOWN.md
vendored
3
.github/MARKDOWN.md
vendored
@@ -2,7 +2,7 @@
|
||||
|
||||
#### 文件格式
|
||||
|
||||
组件文档采用 markdown 格式,和普通 markdown 最大的区别是示例代码是直接写在 markdown 文件里面,所以请确保你写的示例代码是可以正确运行的。
|
||||
组件文档采用 markdown 格式编写
|
||||
|
||||
#### 文档内的标题规范
|
||||
|
||||
@@ -40,4 +40,3 @@
|
||||
|
||||
- 从简单用法开始介绍,不要上来就同时使用一大堆 API,会让人觉得难以上手
|
||||
- 正交性原则,一个示例只演示一个(或者一类)API 的使用方法,如无特殊需求不要在一个示例中同时演示多个 API 混合使用
|
||||
- 如果示例的一句话描述无法完整描述整个场景,可以在 `:::demo` 之前写一段详细的说明性文字
|
||||
|
||||
Reference in New Issue
Block a user