1

We're not talking about variables start with _, just single character _, is it standing for specific attribute in VUE? I saw some code like this:

<script lang="ts">
import { defineComponent } from 'vue';
...
export default defineComponent({
  components: {...}
  setup(_, { emit }) {...}
});
</script>

The setup function running well with _ as first param, and there's no props defined in the code, so I wondered, is _ mean "props is null" here ?

I didn't found any spec for this on network, anyone can help on this?

lciyaya
  • 11
  • 2
  • 1
    It's a convention to indicate that the parameter is not used. I think it initially came from functional programming, but [made its way into javascript](https://stackoverflow.com/a/27637038/4883195) as well – Moritz Ringler Aug 01 '23 at 08:14
  • 1
    @MoritzRingler that's it, thank you ~ – lciyaya Aug 01 '23 at 08:32

0 Answers0