V
V
Valery V.2019-03-15 19:23:32
Vue.js
Valery V., 2019-03-15 19:23:32

How to pass a component to slot?

Good afternoon!
Cannot pass a component to another component's slot.

// компонент Test
<template>
<div>
    <slot name="test_slot"></slot>
</div>
</template>

// создаем экземпляр компонента Test
const TestComponent= Vue.extend(Test);
let component = new TestComponent({
   el: document.createElement('div'),
   propsData
});

// другой компонент
let componentSome = Vue.extend(Some);
let content = new componentSome ({
    el: document.createElement('div')
});

How to pass content to test_slot of Test component?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alex, 2019-03-15
@OlegOleg1980

test.$slots['test_slot'] = [ test.$createElement(some.$options) ]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question