[Vuejs]-Vue multiple components in a single file

5πŸ‘

βœ…

In this case, form-components refers to a .js file that seems to be exporting single-file components (.vue).

form-components.js

export { default as Label } from './form-label.vue'
export { default as Input } from './form-input.vue'

You can then access these components via:

import * as Form from './form-components'

However, I recommend using a destructuring assignment methodology, as it is better interpreted by IDEs.

import { Input, Label } from './form-components'

Leave a comment