mirror of
https://github.com/pyscript/pyscript.git
synced 2026-02-18 22:00:37 -05:00
add inputbox and clearn todo html even more
This commit is contained in:
@@ -17,29 +17,20 @@
|
||||
<py-register-widget src="/pylist.py" name="py-list" klass="PyList"></py-widget>
|
||||
</head>
|
||||
|
||||
<body class="container">
|
||||
|
||||
<main class="max-w-xs mx-auto mt-4">
|
||||
<section>
|
||||
|
||||
<py-title>To Do List</py-title>
|
||||
<div>
|
||||
<input id="new-task-content" class="border flex-1 mr-3 border-gray-300 p-2 rounded" type="text" py-mount>
|
||||
|
||||
<py-button id="new-task-btn" label="Add Task!">
|
||||
def on_click(evt):
|
||||
task = { "content": new_task_content.value, "done": False, "created_at": dt.now() }
|
||||
myList.add(PyItem(task, labels=['content'], state_key="done"))
|
||||
new_task_content.clear()
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<py-list id="myList"></py-list>
|
||||
|
||||
<body>
|
||||
<py-title>To Do List</py-title>
|
||||
<py-box widths="2/3;1/3">
|
||||
<py-inputbox id="new-task-content"></py-inputbox>
|
||||
<py-button id="new-task-btn" label="Add Task!">
|
||||
def on_click(evt):
|
||||
task = { "content": new_task_content.value, "done": False, "created_at": dt.now() }
|
||||
myList.add(PyItem(task, labels=['content'], state_key="done"))
|
||||
new_task_content.clear()
|
||||
</button>
|
||||
</py-box>
|
||||
|
||||
<py-repl id="my-repl" auto-generate="true"> </py-repl>
|
||||
|
||||
</section>
|
||||
</main>
|
||||
</body>
|
||||
<py-list id="myList"></py-list>
|
||||
|
||||
<py-repl id="my-repl" auto-generate="true"> </py-repl>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user