diff --git a/example/components/todo/item/index.js b/example/components/todo/item/index.js
index dcafb425..d563978e 100644
--- a/example/components/todo/item/index.js
+++ b/example/components/todo/item/index.js
@@ -8,13 +8,11 @@ const TodoItem = {
`,
- setup({ query, state }) {
+ setup({ query, state, parent }) {
const remove = query('button')
- console.log('setup todo-item', state)
-
- remove.on('click', function ({ state }) {
- console.log('remove', state)
+ remove.on('click', function () {
+ parent.events.delete(state.id)
})
}
}
diff --git a/example/components/todo/list/index.js b/example/components/todo/list/index.js
index ceb7e78c..53d0435c 100644
--- a/example/components/todo/list/index.js
+++ b/example/components/todo/list/index.js
@@ -16,6 +16,11 @@ const TodoList = {
`,
+ events: {
+ delete(id, { state }) {
+ state.items = state.items.filter(item => item.id !== id)
+ },
+ },
setup({ query, state }) {
const item = query('todo-item')