Created
May 28, 2018 19:35
-
-
Save kyuwoo-choi/bb329cfce5373fa09b5a553fd98b149f to your computer and use it in GitHub Desktop.
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
// todoList.js | |
render() { | |
... | |
const todoItems = todoList | |
.filter(todo => { | |
return ( | |
route === '' || | |
(route === 'completed' && todo.completed) || | |
(route === 'active' && !todo.completed) | |
); | |
}) | |
.map(todo => html`<todo-item todo=${todo}></todo-item>`); | |
return html` | |
${style} | |
<div class="todo"> | |
${btnToggleAll} | |
<div class="todo-list"> | |
${todoItems} | |
</div> | |
</div> | |
`; | |
} | |
... | |
// todoItem.js | |
set todo(todo) { | |
this._todo = todo; | |
this.invalidate(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment