mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[DOC] add example of inline statement in main doc
This commit is contained in:
@@ -190,6 +190,12 @@ class Counter extends Component {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note that the `t-on-click` handler can even be replaced by an inline statement:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<button t-on-click="state.value++">
|
||||||
|
```
|
||||||
|
|
||||||
**Props:** sub components often needs some information from their parents. This
|
**Props:** sub components often needs some information from their parents. This
|
||||||
is done by adding the required information to the template. This will then be
|
is done by adding the required information to the template. This will then be
|
||||||
accessible by the sub component in the `props` object. Note that there is an
|
accessible by the sub component in the `props` object. Note that there is an
|
||||||
|
|||||||
@@ -466,10 +466,6 @@ class TodoItem extends Component {
|
|||||||
useAutofocus("input");
|
useAutofocus("input");
|
||||||
}
|
}
|
||||||
|
|
||||||
editTodo() {
|
|
||||||
this.state.isEditing = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
handleKeyup(ev) {
|
handleKeyup(ev) {
|
||||||
if (ev.keyCode === ENTER_KEY) {
|
if (ev.keyCode === ENTER_KEY) {
|
||||||
this.updateTitle(ev.target.value);
|
this.updateTitle(ev.target.value);
|
||||||
@@ -603,7 +599,7 @@ const TODO_APP_STORE_XML = `<templates>
|
|||||||
<li t-name="TodoItem" class="todo" t-att-class="{completed: props.completed, editing: state.isEditing}">
|
<li t-name="TodoItem" class="todo" t-att-class="{completed: props.completed, editing: state.isEditing}">
|
||||||
<div class="view">
|
<div class="view">
|
||||||
<input class="toggle" type="checkbox" t-on-change="dispatch('toggleTodo', props.id)" t-att-checked="props.completed"/>
|
<input class="toggle" type="checkbox" t-on-change="dispatch('toggleTodo', props.id)" t-att-checked="props.completed"/>
|
||||||
<label t-on-dblclick="editTodo">
|
<label t-on-dblclick="state.isEditing = true">
|
||||||
<t t-esc="props.title"/>
|
<t t-esc="props.title"/>
|
||||||
</label>
|
</label>
|
||||||
<button class="destroy" t-on-click="dispatch('removeTodo', props.id)"></button>
|
<button class="destroy" t-on-click="dispatch('removeTodo', props.id)"></button>
|
||||||
|
|||||||
Reference in New Issue
Block a user