Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image dynamic path (:src / v-bind:src) #182

Closed
xereda opened this issue Nov 11, 2016 · 2 comments
Closed

Image dynamic path (:src / v-bind:src) #182

xereda opened this issue Nov 11, 2016 · 2 comments

Comments

@xereda
Copy link

xereda commented Nov 11, 2016

How to make images that are referenced dynamically, also be considered by the webpack?

Today only the fixed paths and the contents of the "static" directory are considered.

Thank you.

@rstoenescu
Copy link
Member

This is more of a question for Webpack than for Quasar. You can read about handling static assets here: http://quasar-framework.org/guide/app-handling-static-assets.html

Simply reference your image with a relative path (from *.vue file containing that "src"). Alternatively, you can use ~assets/... (to directly reference a file from /src/assets folder (this is due to the fact that the default project template created by Quasar CLI offers the assets Webpack alias).

Example referencing an asset:

<img src="~assets/some-image.png">

Example referencing a static asset:

<img :src=" 'statics/some-image.png' ">
<!-- this is just a trick using dynamic Vue property so Webpack won't pick this image and reference it dynamically -->

@xereda
Copy link
Author

xereda commented Nov 12, 2016

Thanks for the feedback. I'm using statics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants