Skip to content

how to import one more components with loadModule? #58

Discussion options

You must be logged in to vote

When your main app is loaded through vue3-sfc-loader, further components can be loaded using import (or require).
In most of the cases, only one call to loadModule() is needed : for your main .vue file.

main.vue :


import buttonCounter from './button-counter/button-counter.vue'
import myComponent2 from './button-counter/my-component2.vue'

<template>
  <button-counter/>
  <my-component2/>
</template>

<script>

export default {

  components: {
    'button-counter': buttonCounter,
    'my-component2': myComponent2,
  }
}

</script>

see https://github.com/FranckFreiburger/vue3-sfc-loader/blob/main/docs/examples.md#nested-components

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
Answer selected by FranckFreiburger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants