Options API:
<script>
import { defineComponent } from 'vue'
export default defineComponent({
name: 'CustomName', // ๐
inheritAttrs: false, // ๐
setup() {
return {}
},
})
</script>
How to do that in <script setup>, is there an equivalent for name and inheritAttrs like defineProps and defineEmits?
<script setup>
// ๐ how to define them here?
</script>
The <script setup> syntax provides the ability to express equivalent functionality of most existing Options API options except for a few:
nameinheritAttrsIf you need to declare these options, use a separate normal <script> block with export default:
<script>
export default {
name: 'CustomName',
inheritAttrs: false,
customOptions: {},
}
</script>
<script setup>
// script setup logic
</script>
Compiled output:
<script>
export default {
name: 'CustomName',
inheritAttrs: false,
customOptions: {},
setup() {
// script setup logic
},
}
</script>