update tutorial
This commit is contained in:
parent
9dd72d3c89
commit
9f48b5ad91
|
@ -358,17 +358,6 @@ define('todo-list', class extends WeElement {
|
|||
})
|
||||
```
|
||||
|
||||
需要特别强调的是,当你从数组中移除的时候,需要先清空数组:
|
||||
|
||||
```js
|
||||
remove(id) {
|
||||
todo.remove(id)
|
||||
//empty first
|
||||
this.data.items.length = 0
|
||||
mapping.auto(todo, this.data)
|
||||
}
|
||||
```
|
||||
|
||||
[→ 完整代码戳这里](https://github.com/Tencent/omi/tree/master/packages/omi-cli/template/mvvm/src)
|
||||
|
||||
|
||||
|
|
|
@ -350,17 +350,6 @@ define('todo-list', class extends WeElement {
|
|||
})
|
||||
```
|
||||
|
||||
Needing to pay attention to is that, when you remove item from an array, you need to clear the array first, then using mapping.atuo:
|
||||
|
||||
```js
|
||||
remove(id) {
|
||||
todo.remove(id)
|
||||
//empty first
|
||||
this.data.items.length = 0
|
||||
mapping.auto(todo, this.data)
|
||||
}
|
||||
```
|
||||
|
||||
[→ All the source code](https://github.com/Tencent/omi/tree/master/packages/omi/examples/mvvm)
|
||||
|
||||
### Summary
|
||||
|
|
Loading…
Reference in New Issue