add list item as separate element
This commit is contained in:
parent
09d9676c1e
commit
a31c432f5e
|
@ -1,4 +1,5 @@
|
||||||
import {vbox, completed} from './styles/index.css'
|
import {vbox, completed} from './styles/index.css'
|
||||||
|
import { List } from './item-list'
|
||||||
|
|
||||||
var store = {
|
var store = {
|
||||||
title: ""
|
title: ""
|
||||||
|
@ -15,16 +16,11 @@ tag App
|
||||||
data:items.push(title: data:title)
|
data:items.push(title: data:title)
|
||||||
data:title = ""
|
data:title = ""
|
||||||
|
|
||||||
def completeItem item
|
|
||||||
console.log "clicked,{item:completed}"
|
|
||||||
item:completed = !item:completed
|
|
||||||
|
|
||||||
def render
|
def render
|
||||||
<self.{vbox}>
|
<self.{vbox}>
|
||||||
<header>
|
<header>
|
||||||
<input[data:title] placeholder="New..." :keyup.enter.addItem>
|
<input[data:title] placeholder="New..." :keyup.enter.addItem>
|
||||||
<button :tap.addItem> 'Add item'
|
<button :tap.addItem> 'Add item'
|
||||||
<ul> for item in data:items
|
<List list=data:items>
|
||||||
<li .{item:completed and completed} :tap.completeItem(item)> item:title
|
|
||||||
|
|
||||||
Imba.mount <App[store]>
|
Imba.mount <App[store]>
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
export tag List
|
||||||
|
prop list
|
||||||
|
|
||||||
|
def completeItem item
|
||||||
|
console.log "clicked,{item:completed}"
|
||||||
|
item:completed = !item:completed
|
||||||
|
|
||||||
|
def render
|
||||||
|
<self>
|
||||||
|
<ul> for item in list
|
||||||
|
<li .{item:completed} :tap.completeItem(item)> item:title
|
Loading…
Reference in New Issue