mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
23 lines
601 B
JavaScript
23 lines
601 B
JavaScript
|
|
// This example illustrate how the t-model directive can be used to synchronize
|
||
|
|
// data between html inputs (and select/textareas) and the state of a component.
|
||
|
|
// Note that there are two controls with t-model="color": they are totally
|
||
|
|
// synchronized.
|
||
|
|
import { Component, useState, mount } from "@odoo/owl";
|
||
|
|
|
||
|
|
class Form extends Component {
|
||
|
|
static template = "Form";
|
||
|
|
|
||
|
|
setup() {
|
||
|
|
this.state = useState({
|
||
|
|
text: "",
|
||
|
|
othertext: "",
|
||
|
|
number: 11,
|
||
|
|
color: "",
|
||
|
|
bool: false
|
||
|
|
});
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// Application setup
|
||
|
|
mount(Form, document.body, { templates: TEMPLATES, dev: true });
|