Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do the hash marks (#) mean in Vue?

I am a rather new Vue developer. Everywhere I go in our stack, I see code like this inside our components components:

<template #item.active="{ value }">
  <div :aria-label="String(value)" class="text-center">
    <v-icon v-if="value === null">mdi-minus</v-icon>
    <v-icon v-else color="red">mdi-close</v-icon>
  </div>
</template>

And for the life of me, I am cannot figure out what the #item.active (specifically the #) actually does. We have many hashed items. Like <template #item.actions-prepend="{item}"> or <template #toolbar-extension>

Googling a # isn't an easy thing to do. And apparently I missed this specific video in my Vue tutorials! We use Nuxt and Vuetify, not sure if that helps!

like image 319
dustbuster Avatar asked Sep 03 '20 20:09

dustbuster


1 Answers

As mentioned in the comments, the # symbol is a shorthand for the v-slot attribute, as hinted by the usage of <template> (which v-slot only allows to be used on, as well as components) in your code.

like image 164
Edric Avatar answered Oct 11 '22 23:10

Edric