Skip to content

Multiple roots with v-model giving warnings #1510

@Kurira

Description

@Kurira

What problem does this feature solve?

I have a component which looks similar to this

<template>
    <div>{{ modelValue }}</div>
    <div>Some other content</div>
</template>

<script lang="ts">
import { defineComponent } from "vue";

export default defineComponent({
    props: {
        modelValue: String
    },
    setup() {
        return { };
    }
});
</script>

whenever I use v-model on the component <my-component v-model="value" /> which has multiple roots it always gives warnings

[Vue warn]: Extraneous non-emits event listeners (update:modelValue) were passed to component but could not be
automatically inherited because component renders fragment or text root nodes. If the listener is intended to be
a component custom event listener only, declare it using the "emits" option. 
  at <my-component modelValue=null onUpdate:modelValue=fn > 

can multi roots be supported with v-model without warnings? Or any way to wrap it with non-renderable tag?

What does the proposed API look like?

none

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