-
Notifications
You must be signed in to change notification settings - Fork 0
7 数据状态管理Mobx
xiaozhongHu edited this page Nov 14, 2017
·
3 revisions
class Todo {
id = Math.random();
constructor(content) {
extendObservable(this, {
content: content,
finished: false
})
}
}
class TodoList {
constructor() {
extendObservable(this, {
todos: [],
todoListString: function() {
return this.todos.filter(todo => !todo.finished).map((todo, i) => `${i+1}. ${todo.content}`).join('\n');
}
})
}
}```
Footer
how