mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[DOC] doc: update component.md to add info on t-widget
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
- [Overview](#overview)
|
- [Overview](#overview)
|
||||||
- [Example](#example)
|
- [Example](#example)
|
||||||
|
- [Templates](#templates)
|
||||||
- [Reference](#reference)
|
- [Reference](#reference)
|
||||||
- [Properties](#properties)
|
- [Properties](#properties)
|
||||||
- [Methods](#methods)
|
- [Methods](#methods)
|
||||||
@@ -64,6 +65,23 @@ a state object is defined. It is not mandatory to use the state object, but it
|
|||||||
is certainly encouraged. The state object is [observed](observer.md), and any
|
is certainly encouraged. The state object is [observed](observer.md), and any
|
||||||
change to it will cause a rerendering.
|
change to it will cause a rerendering.
|
||||||
|
|
||||||
|
## Templates
|
||||||
|
|
||||||
|
The example above shows a QWeb template with a `t-on-click` directive. Widget
|
||||||
|
templates are standard [QWeb](qweb.md) templates, but with an extra directive:
|
||||||
|
`t-widget`. With the `t-widget` directive, widget templates can declare sub
|
||||||
|
widgets:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<div>
|
||||||
|
<span>some text</span>
|
||||||
|
<t t-widget="MyWidget" t-props="{info: 13}">
|
||||||
|
</div>
|
||||||
|
```
|
||||||
|
|
||||||
|
In this example, the template create a widget MyWidget just after the span. See
|
||||||
|
the [QWeb](qweb.md) documentation for more information on the `t-widget` directive.
|
||||||
|
|
||||||
## Reference
|
## Reference
|
||||||
|
|
||||||
An Owl component is a small class which represent a widget or some UI element.
|
An Owl component is a small class which represent a widget or some UI element.
|
||||||
|
|||||||
Reference in New Issue
Block a user