[DOC] doc: update component.md to add info on t-widget

This commit is contained in:
Géry Debongnie
2019-04-25 17:10:07 +02:00
parent cf47f8459a
commit 9544034e6f
+18
View File
@@ -4,6 +4,7 @@
- [Overview](#overview)
- [Example](#example)
- [Templates](#templates)
- [Reference](#reference)
- [Properties](#properties)
- [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
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
An Owl component is a small class which represent a widget or some UI element.