-
Notifications
You must be signed in to change notification settings - Fork 753
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.