FrontendDeveloper.in

Vue.js question detail

What is the purpose new slot directive?

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>
Back to all Vue.js questions
Get LinkedIn Premium at Rs 399