mirror of
https://github.com/django-components/django-components.git
synced 2025-09-19 04:09:44 +00:00
Update indenting typo in slots_and_blocks.md
(#959)
This commit is contained in:
parent
61515b3454
commit
fe128053c9
1 changed files with 32 additions and 32 deletions
|
@ -5,44 +5,44 @@
|
|||
template was inlined. So if the "included" template contains `slot` tags, then the component
|
||||
uses those slots.
|
||||
|
||||
So if you have a template `abc.html`:
|
||||
```django
|
||||
<div>
|
||||
hello
|
||||
{% slot "body" %}{% endslot %}
|
||||
</div>
|
||||
```
|
||||
So if you have a template `abc.html`:
|
||||
```django
|
||||
<div>
|
||||
hello
|
||||
{% slot "body" %}{% endslot %}
|
||||
</div>
|
||||
```
|
||||
|
||||
And components that make use of `abc.html` via `include` or `extends`:
|
||||
```py
|
||||
from django_components import Component, register
|
||||
And components that make use of `abc.html` via `include` or `extends`:
|
||||
```py
|
||||
from django_components import Component, register
|
||||
|
||||
@register("my_comp_extends")
|
||||
class MyCompWithExtends(Component):
|
||||
template = """{% extends "abc.html" %}"""
|
||||
@register("my_comp_extends")
|
||||
class MyCompWithExtends(Component):
|
||||
template = """{% extends "abc.html" %}"""
|
||||
|
||||
@register("my_comp_include")
|
||||
class MyCompWithInclude(Component):
|
||||
template = """{% include "abc.html" %}"""
|
||||
```
|
||||
@register("my_comp_include")
|
||||
class MyCompWithInclude(Component):
|
||||
template = """{% include "abc.html" %}"""
|
||||
```
|
||||
|
||||
Then you can set slot fill for the slot imported via `include/extends`:
|
||||
Then you can set slot fill for the slot imported via `include/extends`:
|
||||
|
||||
```django
|
||||
{% component "my_comp_extends" %}
|
||||
{% fill "body" %}
|
||||
123
|
||||
{% endfill %}
|
||||
{% endcomponent %}
|
||||
```
|
||||
```django
|
||||
{% component "my_comp_extends" %}
|
||||
{% fill "body" %}
|
||||
123
|
||||
{% endfill %}
|
||||
{% endcomponent %}
|
||||
```
|
||||
|
||||
And it will render:
|
||||
```html
|
||||
<div>
|
||||
hello
|
||||
123
|
||||
</div>
|
||||
```
|
||||
And it will render:
|
||||
```html
|
||||
<div>
|
||||
hello
|
||||
123
|
||||
</div>
|
||||
```
|
||||
|
||||
2. Slot and block
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue