Skip to content

Commit

Permalink
docs(form): 补充文档
Browse files Browse the repository at this point in the history
  • Loading branch information
jimczj committed Sep 6, 2018
1 parent e632bfa commit 7b7e3fe
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 0 deletions.
57 changes: 57 additions & 0 deletions docs/markdown/form.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Form 表单组件

---
将组件内的用户输入的值提交。当点击 表单中 formType 为 submit 的 button 组件时,会将表单组件中的 value 值进行提交,需要在表单组件中加上 name 来作为 key。

**目前该组件只对 AtInput 组件有效**

## 使用指南

在 Taro 文件中引入组件

:::demo

```js
import { AtForm, AtInput } from 'taro-ui'
```

:::

## 一般用法

:::demo

```html

<AtForm
onSubmit={this.onSubmit.bind(this)}
onReset={this.onReset.bind(this)}
>
<AtInput
name='value1'
title='文本'
type='text'
placeholder='单行文本'
value={this.state.value1}
onChange={this.handleChange.bind(this)}
/>
</AtForm>

```

:::

## 参数

| 参数 | 说明 | 类型 | 可选值 | 默认值 |
| ---------- | -------------------------------------- | ------- | ------------------------------------------------------------------- | -------- |
| style | 样式 | String or Object | - | - |
| reportSubmit | 是否返回 formId 用于发送模板消息 | Boolean | - | false |


## 事件

| 事件名称 | 说明 | 返回参数 |
|---------- |-------------- |---------- |
| onSubmit | 携带 form 中的数据触发 submit 事件 | event |
| onReset | 表单重置时会触发 reset 事件 | event |
2 changes: 2 additions & 0 deletions docs/nav.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ components:
name: Toast
- title: 表单组件
items:
- title: 表单
name: Form
- title: 输入框
name: Input
- title: 数字输入框
Expand Down
10 changes: 10 additions & 0 deletions docs/view/Form/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as Nerv from 'nervjs'
import FormDoc from '@md/form.md'

class FormView extends Nerv.Component {
render () {
return <FormDoc />
}
}

export default FormView
Empty file added docs/view/Form/index.scss
Empty file.

0 comments on commit 7b7e3fe

Please sign in to comment.