No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    How to use Quasar components as dynamic components?

    Help
    3
    6
    1397
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      ddenev last edited by

      What is the proper way to use Quasar components as a dynamic components, i.e.:

      <component is="q-btn" />
      

      Currently I get the following error:

      Unknown custom element: <q-btn> - did you register the component correctly?
      

      My use case is - I am creating a wrapper component to add drag-n-drop functionality so I need to be able to pass the wrapped component as a prop to my drag wrapper, which in turn uses <component :is="tag" /> to render the actual wrapped component.

      1 Reply Last reply Reply Quote 0
      • dobbel
        dobbel last edited by

        What importStrategy are you using ?

        https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-framework

        if you use dynamic components use ‘importStrategy: all’ or uncomment the line // components: [] and fill with components: [‘QBtn’, ‘QBanner’, ect]

        1 Reply Last reply Reply Quote 1
        • D
          ddenev last edited by

          importStrategy: 'auto'

          Yes, if I put 'QBtn' in components then it works.

          So if I want to use dynamic components I have to manually put them in components… what an irony 🙂

          dobbel metalsadman 2 Replies Last reply Reply Quote -1
          • dobbel
            dobbel @ddenev last edited by

            @ddenev or use importStrategy: 'all'

            1 Reply Last reply Reply Quote 0
            • metalsadman
              metalsadman @ddenev last edited by metalsadman

              @ddenev Auto only detects those that are in templates, you are doing dynamic, same if you use components/directives in Js files using render functions, then you’ll have to import it manually on the same file or register it normally like you did at quasar.conf.js.

              1 Reply Last reply Reply Quote 0
              • D
                ddenev last edited by

                @dobbel and @metalsadman , thank you!

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post