Add inferred component name(__name) to <script>
What problem does this feature solve?
compiler-sfc
adds __name
property to <script setup>
, but it does not adds __name
property to regular <script>
. Is it appropriate to add __name
to all types of <script>
so I can get inferred name if one component does not have a name
property.
What does the proposed API look like?
In all conditions, I can get __name
:
export default {
mounted() {
console.log(this.$options.__name)
}
}
<script setup>
const inst = getCurrentInstance().proxy
onMounted(() => {
console.log(inst.$options.name)
})
</script>