Vue.js (original) (raw)

Options: Misc

name

Explicitly declare a display name for the component.

interface ComponentOptions {  
  name?: string  
}  

inheritAttrs

Controls whether the default component attribute fallthrough behavior should be enabled.

interface ComponentOptions {  
  inheritAttrs?: boolean // default: true  
}  
<script>  
export default {  
  inheritAttrs: false,  
  props: ['label', 'value'],  
  emits: ['input']  
}  
</script>  
<template>  
  <label>  
    {{ label }}  
    <input  
      v-bind="$attrs"  
      v-bind:value="value"  
      v-on:input="$emit('input', $event.target.value)"  
    />  
  </label>  
</template>  

When declaring this option in a component that uses <script setup>, you can use the defineOptions macro:
vue

<script setup>  
defineProps(['label', 'value'])  
defineEmits(['input'])  
defineOptions({  
  inheritAttrs: false  
})  
</script>  
<template>  
  <label>  
    {{ label }}  
    <input  
      v-bind="$attrs"  
      v-bind:value="value"  
      v-on:input="$emit('input', $event.target.value)"  
    />  
  </label>  
</template>