in VueJS by
What is the purpose new slot directive?

1 Answer

0 votes
by

In Vue 2.6 version, the new slot syntax is provided using v-slot directive which aligns syntax with Vue 3.0. This is going to be replacement for old slot syntax.

The comparison for old and new slot syntax:

<!-- old -->
<user>
  <template slot="header" slot-scope="{ msg }">
    text slot: {{ msg }}
  </template>
</user>

<!-- new -->
<user>
  <template v-slot:header="{ msg }">
    text slot: {{ msg }}
  </template>
</user>
...