mirror of
https://github.com/django-components/django-components.git
synced 2025-09-19 20:29:44 +00:00
docs: update docs on slots (#1208)
This commit is contained in:
parent
e054a68715
commit
223fc2c68c
5 changed files with 859 additions and 521 deletions
|
@ -137,7 +137,7 @@ class Calendar(Component):
|
||||||
[`{% component %}`](https://django-components.github.io/django-components/latest/reference/template_tags#component) tag.
|
[`{% component %}`](https://django-components.github.io/django-components/latest/reference/template_tags#component) tag.
|
||||||
- Compose them with [`{% slot %}`](https://django-components.github.io/django-components/latest/reference/template_tags#slot)
|
- Compose them with [`{% slot %}`](https://django-components.github.io/django-components/latest/reference/template_tags#slot)
|
||||||
and [`{% fill %}`](https://django-components.github.io/django-components/latest/reference/template_tags#fill) tags.
|
and [`{% fill %}`](https://django-components.github.io/django-components/latest/reference/template_tags#fill) tags.
|
||||||
- Vue-like slot system, including [scoped slots](https://django-components.github.io/django-components/latest/concepts/fundamentals/slots/#scoped-slots).
|
- Vue-like slot system, including [scoped slots](https://django-components.github.io/django-components/latest/concepts/fundamentals/slots/#slot-data).
|
||||||
|
|
||||||
```django
|
```django
|
||||||
{% component "Layout"
|
{% component "Layout"
|
||||||
|
|
|
@ -7,8 +7,8 @@ nav:
|
||||||
- Component defaults: component_defaults.md
|
- Component defaults: component_defaults.md
|
||||||
- Render API: render_api.md
|
- Render API: render_api.md
|
||||||
- Rendering components: rendering_components.md
|
- Rendering components: rendering_components.md
|
||||||
- Template tag syntax: template_tag_syntax.md
|
|
||||||
- Slots: slots.md
|
- Slots: slots.md
|
||||||
|
- Template tag syntax: template_tag_syntax.md
|
||||||
- HTML attributes: html_attributes.md
|
- HTML attributes: html_attributes.md
|
||||||
- Component views and URLs: component_views_urls.md
|
- Component views and URLs: component_views_urls.md
|
||||||
- HTTP Request: http_request.md
|
- HTTP Request: http_request.md
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -189,7 +189,8 @@ which is NOT the same as the `date` variable used inside Calendar's template.
|
||||||
|
|
||||||
We want to use the same `date` variable that's used inside Calendar's template.
|
We want to use the same `date` variable that's used inside Calendar's template.
|
||||||
|
|
||||||
Luckily, django-components allows passing data to the slot, also known as [Scoped slots](../../concepts/fundamentals/slots#scoped-slots).
|
Luckily, django-components allows [passing data to slots](../../concepts/fundamentals/slots#slot-data),
|
||||||
|
also known as [Scoped slots](https://vuejs.org/guide/components/slots#scoped-slots).
|
||||||
|
|
||||||
This consists of two steps:
|
This consists of two steps:
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ and render the component inside a template:
|
||||||
|
|
||||||
!!! info
|
!!! info
|
||||||
|
|
||||||
Component tags should end with `/` if they do not contain any [Slot fills](../../concepts/fundamentals/slots#slot-fills).
|
Component tags should end with `/` if they do not contain any [Slot fills](../../concepts/fundamentals/slots).
|
||||||
But you can also use `{% endcomponent %}` instead:
|
But you can also use `{% endcomponent %}` instead:
|
||||||
|
|
||||||
```htmldjango
|
```htmldjango
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue