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

    QImg and ~assets src

    Help
    3
    5
    3669
    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.
    • S
      stuartcusack last edited by stuartcusack

      I’m struggling to understand why this works:

      <img src="~assets/logo.png">
      

      But this doesn’t:

      <q-img src="~assets/logo.png" />
      

      Can someone explain?

      What way should I be referencing the assets folder so that QImgs are loaded correctly for both SPA and Electron? Should I always use statics instead of assets for logos?

      1 Reply Last reply Reply Quote 1
      • S
        sergaks last edited by

        I’m also struggling to understand why:
        <q-img src="~assets/logo.png" /> work for prod build, but not for dev
        <q-img src=“assets/logo.png” /> work for dev build, but not for prod

        1 Reply Last reply Reply Quote 0
        • s.molinari
          s.molinari last edited by

          Read this: https://v1.quasar-framework.org/quasar-cli/cli-documentation/handling-assets

          And this (look at the model bit): https://v1.quasar-framework.org/vue-components/img#QImg-API

          Scott

          S 1 Reply Last reply Reply Quote 0
          • S
            stuartcusack @s.molinari last edited by stuartcusack

            @s-molinari Thanks. I did before I wrote the post. I was hoping somebody could explain it in ways that the docs do not.

            1 Reply Last reply Reply Quote 0
            • s.molinari
              s.molinari last edited by

              It’s because q-img uses the binding of the prop :src.

              And this explains why you need to add the statics value or add your own require('some/folder/blah.jpg') in the :src="" prop.

              Scott

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