Skip to content

Suppress "Extraneous non-props attributes (prop) were passed to component but could not be automatically inherited because component renders fragment or text root nodes." #3061

@wenfangdu

Description

@wenfangdu

What problem does this feature solve?

When conditionally rendering parent component, but still want to keep the children elements, I found the new fragment pattern could meet this need. When deliberately render fragment, I don't want vue to warn the extra props being passed since they might be used by custom-component. I don't know if there's a better way to achieve this.

<template>
  <component :is="condition ? 'custom-component' : 'v-fragment'" prop="prop">
    ...
  </component>
</template>

VFragment.vue

<template>
  <slot></slot>
</template>

What does the proposed API look like?

Something like fragmentWarning: false, sorry, can't come up with a better one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions