QImg and ~assets src
-
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?
-
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 -
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-molinari Thanks. I did before I wrote the post. I was hoping somebody could explain it in ways that the docs do not.
-
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