Skip to content

Vue Composition API: Inheriting Attributes

Mike Lyttle edited this page May 9, 2023 · 1 revision

Class Component

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const options: any = {
    inheritAttrs: false,
};

@Component(options)

Composition API

<script lang="ts">
export default {
    inheritAttrs: false
}
</script>
<script setup lang="ts">
    // ...setup logic
</script>

Notes

  • By default, unknown attributes will be passed along to the root element of the template. To pass them to a different element, use v-bind="$attrs" on that element and set inheritAttrs to false in a normal <script> block (not the <script setup> block).

Documentation

Clone this wiki locally