Skip to content

Attribute modifiers #13

@BjornDCode

Description

@BjornDCode

The following rules exists for modifers in components:

  1. All unused attributes are applied to the root element
  2. Attributes override existing attributes on the root element
  3. It's possible to 'merge' attributes with the following syntax: class="existing-class-name {{ class }}"

It works but is not very explicit. We should support some modifiers both when defining attributes inside components and when using components.

Inside component definitions:

<div :class="existing-class-name" !id="my-component">

</div>

The : modifier makes the attribute 'mergable'. That means the class attribute will automatically get merged with any classes passed in when using the component.

The ! modifier makes the attribute 'non-overridable'. If passing in an 'id' it will cause a compilation error unless the attribute is explicitly used somewhere else in the component definition.

When using components it's also possible to use the ! modifier. This will make it so the attributes overrides an attribute in the definition markes as mergable

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions