bug in q-img v-else
-
Hello, I have a conditional rendering of images
The v-else is working and render “shop-logo.svg” in the following code :<q-img v-if="image && image.blob" :src="image.blob" /> <q-img v-else-if="image && image.url" :src="image.url" /> <img v-else src="~assets/shop-logo.svg" /> </div>
but not with <q-img> :
<q-img v-if="image && image.blob" :src="image.blob" /> <q-img v-else-if="image && image.url" :src="image.url" /> <q-img v-else src="~assets/shop-logo.svg" /> </div>
It doesn’t render anything.
Do I miss something, or it could be a bug ? Thanks -
This post is deleted! -
-
@dobbel
displays no image :
<q-img src="~assets/shop-logo.svg" />
<q-img v-else src="~assets/shop-logo.svg" />displays the image :
<img v-else src="~assets/shop-logo.svg" />
<img src="~assets/shop-logo.svg" /> -
@incremental said in bug in q-img v-else:
assets
what if you put the svg in
statics
?<q-img src="statics/shop-logo.svg"/>
Or
<q-img :src="shop_logo"/> import shop_logo_svg from 'src/assets/shop-logo.svg' ... data() { .... shop_logo : undefined } created() { this.shop_logo = shop_logo_svg }
-
@incremental https://github.com/quasarframework/quasar/issues/4763 try the workarounds in that ticket. Relative path or what dobbel suggested above.
-
@dobbel I created a static directory and put my svg file. It’s the same, I get no image.
I tried your code, but it’s the same.
… and works with <img :src=“shop_logo”/>As it works with a .jpg file, I will change my picture for a .jpg
Thanks