Skip to content

Commit 705dace

Browse files
committed
edit md
1 parent fdefd41 commit 705dace

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

‎react/component/src/form/README.md‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# 表单
2-
React 是个单向数据流的框架,所以在表单元素与其它 DOM 元素有所不同,而且和双向绑定的框架在操作上也有很大不一样。所以在这里单独拿出来说。
2+
React 是个单向数据流的框架,所以在表单元素与其它 DOM 元素有所不同,而且和双向绑定的框架在操作上也有很大不一样。所以在这里单独拿出来说。在 Vue 和 Angular 框架上分别有对应的 `v-model` 和 `ng-model` 指令在 `<select>`,`<input>`和`<textarea>`实现数据绑定。
33

44
## 输入受控
55
```javascript
@@ -49,7 +49,10 @@ class Component1 extends React.Component{
4949
}
5050
}
5151
```
52-
[效果预览](https://wscats.github.io/react-tutorial/react/component/src/form/input.html)
52+
53+
### 效果预览
54+
55+
- [input表单输入](https://wscats.github.io/react-tutorial/react/component/src/form/input.html)
5356

5457
## textarea 元素
5558
在普通 HTML 中,`textarea` 元素是节点文本值
@@ -81,6 +84,7 @@ class Component1 extends React.Component{
8184
```
8285

8386
## select 元素
87+
8488
在普通 HTML 中, `select`元素要指定默认选中值,就得在对应的`option`中加上属性`selected`
8589
```html
8690
<select>
@@ -118,6 +122,7 @@ class Component1 extends React.Component{
118122
```
119123

120124
## input file 元素
125+
121126
因为`<input type="file">`是特殊的元素,它是只读的,所以在 React 中需要用`ref`来进行特殊处理
122127
```javascript
123128
class Component1 extends React.Component{

‎react/component/src/state/README.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ React 里面
9696
所以我们要更新视图,就必须把关注点放在更改 state 上,而更改 state 就要通过`setState`方法来实现
9797

9898
```html
99-
<!-- html -->
10099
<button onClick={this.changeValue.bind(this)}>{this.state.title</button>
101100
```
102101
上面的`<button>`值会因为点击而改变,原因就是因为用户触发了点击事件,而事件动用了`setState`方法更改`state`的状态,从而更新按钮的值

0 commit comments

Comments
 (0)