FrontendDeveloper.in

Vue.js question detail

What are slots?

Vue implements a content distribution API using the <slot> element to serve as distribution outlets for content created after the current Web Components spec draft.

Let's create an alert component with slots for content insertion,

Vue.component('alert', {
template: `
<strong>Error!</strong>
<slot></slot>
`
})

Now you can insert dynamic content as below,

<alert>
There is an issue with in application.
Back to all Vue.js questions
Get LinkedIn Premium at Rs 399