Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scoped slots are not passed to python described elements #3939

Open
zceemja opened this issue Nov 1, 2024 · 0 comments
Open

Scoped slots are not passed to python described elements #3939

zceemja opened this issue Nov 1, 2024 · 0 comments

Comments

@zceemja
Copy link

zceemja commented Nov 1, 2024

Description

This is on the same topic as #167 and #501. Here is the code to expand the idea (tested on nicegui 2.5.0):

from nicegui import ui

columns = [
    {'name': 'id', 'label': 'ID', 'field': 'id'},
    {'name': 'name', 'label': 'Name', 'field': 'name'},
]
rows = [{'id': i, 'name': f'row-{i}'} for i in range(5)]

table = ui.table(columns=columns, rows=rows, row_key='id')
table.add_slot('body', r'''
<q-tr :props="props">
    <q-td key="id" :props="props">{{props.row.id}}</q-td>
</q-tr>''')

ui.run(prod_js=False)

And this works as expected. Props are passed down to q-td and is visible from vue debugging on browser:

image

But this does not work when describing with body slot with python:

...
table = ui.table(columns=columns, rows=rows, row_key='id')
with table.add_slot('body'):
    with table.row().props(':props=props'):
        with table.cell().props('key=id :props=props'):
            ...
...

image
However there seems to be some disconnect (missing anonymous component?) between body slot and QTr and props.row are not accessible.

Reason why I find this useful is that body description in python enables inserting custom vue components, and the only way I see to do it now is rewriting whole table with custom component as new combined component, which is a lot of duplicated boilerplate code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant