update readme
This commit is contained in:
parent
404466858b
commit
42515d8520
16
README.CN.md
16
README.CN.md
|
@ -631,6 +631,22 @@ define("my-app", class extends WeElement {
|
|||
|
||||
因为 data 设置只会简单对比前后的值,复杂对象不会深对比,对比值不同会触发 update ,update 会触发上面函数,就无限递归了。
|
||||
|
||||
举例说明:
|
||||
|
||||
❌错误方式:
|
||||
```js
|
||||
beforeRender(){
|
||||
this.data.a = { b: 1 }
|
||||
}
|
||||
```
|
||||
|
||||
✅ 正确方式:
|
||||
```js
|
||||
beforeRender(){
|
||||
this.data.a.b = 1
|
||||
}
|
||||
```
|
||||
|
||||
如果你想要兼容 IE11,请使用 `omi-mobx` 代替 omi 自带的 observe,往下看..
|
||||
|
||||
### Omi Mobx
|
||||
|
|
16
README.md
16
README.md
|
@ -631,6 +631,22 @@ It should be noted that if `observe` is used, do not set the value of data in so
|
|||
|
||||
Because data settings will simply compare the value before and after, complex objects will not be deep contrast, the contrast value will trigger different update, update will trigger the above function, infinite recursion.
|
||||
|
||||
For Example:
|
||||
|
||||
❌Wrong way:
|
||||
```js
|
||||
beforeRender(){
|
||||
this.data.a = { b: 1 }
|
||||
}
|
||||
```
|
||||
|
||||
✅ Right way:
|
||||
```js
|
||||
beforeRender(){
|
||||
this.data.a.b = 1
|
||||
}
|
||||
```
|
||||
|
||||
If you want to be compatible with IE11, please use the `omi-mobx` instead of omi's own observe.
|
||||
|
||||
### Omi Mobx
|
||||
|
|
Loading…
Reference in New Issue