DEV Community

Discussion on: How to use global components in VueJs

Collapse
 
eugenman profile image
Eugen

What if i want this two (or more) components import in "one line import".
Like:
import components from 'someWay/components.js';

What it looks like?

Collapse
 
alexc957 profile image
alexc957

interesting question, I think you have to register them like this:

import components from 'someWay/components.js';
export default {
components: {
components.MyFirstChild,
components.MySecondChild,
.....
......
}
}

I don't know if this might work, because I am more familiar working with the vue CLI and with a project created with the CLI is pretty common to have each component in his own .vue file rather many components in a single file.