Skip to content

New ":attrs" syntax includes variables defined in <c-vars> #285

@danjac

Description

@danjac

Suppose I have a card component like this:

<c-vars title image url />
<a class="card" href="{{ url }}" {{ attrs }}>
  <img class="card-img" src="{{ image }}">
   <h3 class="card-title">{{ title }}</h3>
  {{ slot }}
</a>

I have another component, product which wraps the card component like so:

<c-vars product />
<c-card :title=product.name :url=product.url :image=product.image :attrs="attrs">
  {{ product.description>
</c-card>

and then call it like so:

<c-product :product="product" target="_blank" />

The result is something like this:

<a href="<link to my product>" class="card" target="_blank" product="<str of product>">
   <h3>Product title</h3>
   ...

In other words the nested component is rendered correctly, except the variable product is added to the attrs passed down to :attrs, even though it is in the <c-vars > list. The expectation is that any item in <c-vars /> is not included in attrs, whether rendered in that component or passed down to a nested component using :attrs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions