mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] slots: add new t-set-slot directive
This new t-set-slot directive is meant to replace t-set when we need to define the content of a sub slot. All new code should use that directive. The old t-set directive is still supported for now, but this should be removed when we publish Owl 2.0.
This commit is contained in:
@@ -37,16 +37,16 @@ rendering context.
|
||||
</div>
|
||||
```
|
||||
|
||||
Slots are defined by the caller, with the `t-set` directive:
|
||||
Slots are defined by the caller, with the `t-set-slot` directive:
|
||||
|
||||
```xml
|
||||
<div t-name="SomeComponent">
|
||||
<div>some component</div>
|
||||
<Dialog title="Some Dialog">
|
||||
<t t-set="content">
|
||||
<t t-set-slot="content">
|
||||
<div>hey</div>
|
||||
</t>
|
||||
<t t-set="footer">
|
||||
<t t-set-slot="footer">
|
||||
<button t-on-click="doSomething">ok</button>
|
||||
</t>
|
||||
</Dialog>
|
||||
@@ -57,6 +57,9 @@ In this example, the component `Dialog` will render the slots `content` and `foo
|
||||
with its parent as rendering context. This means that clicking on the button
|
||||
will execute the `doSomething` method on the parent, not on the dialog.
|
||||
|
||||
Note: Owl previously used the `t-set` directive to define the content of a slot.
|
||||
This is deprecated and should no longer be used in new code.
|
||||
|
||||
## Reference
|
||||
|
||||
Default slot: the first element inside the component which is not a named slot will
|
||||
|
||||
Reference in New Issue
Block a user