Answer the question
In order to leave comments, you need to log in
Is it possible to get data from a component that has a dynamic import attached?
Good evening!
There is such a component, inside which a component is connected through dynamic import:
export default {
name: 'MyComponent',
components: {
Test1: () => import('@/components/test1.vue')
}
}
import Test1 from '@/components/test1.vue';
export default {
name: 'MyComponent',
components: {
Test1
},
mounted () {
console.log(Test1.props); // Так я могу получить список всего его свойств и т.п. данные
}
}
Answer the question
In order to leave comments, you need to log in
components: {
componentName: () => import('...').then(component => {
console.log(component.default.props);
return component;
}),
...
},
const Test1 = () => import('@/components/test1.vue');
export default {
name: 'MyComponent',
components: {
Test1
},
mounted () {
Test1().then((m) => {
// Компонент
console.dir(m.default);
// Его пропсы
console.log(m.default.props);
});
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question