provide a compiler macro "defineOptions"
What problem does this feature solve?
In script setup, if we want to declare some options like name
or inheritAttrs
, we need to add a new script block without setup, how about place options in defineOptions({ name: 'MyComponent' })
, so we still use a single setup script, and no need to add extra script tag.
What does the proposed API look like?
Just like defineProps and defineEmits, offer an api named defineOptions
<script setup>
defineOptions({
name: 'MyComponent',
inheritAttrs: false
})
</script>
Duplicate of #5218, see RFC