How to load images from src/assets/static/images ?
See original GitHub issueI stored the images on src/assets/static/images
as on template. But how to load it to app? Since there is no images on www folder.
Issue Analytics
- State:
- Created 7 years ago
- Comments:22
Top Results From Across the Web
How to reference static assets within vue javascript
To get the images from JS code, use require('../assets.myImage.png') . The path must be relative (see below). So your code would be: var...
Read more >How to load dynamic images in Vue and Nuxt with ease
Importing images from the assets folder when the path is static is not that difficult in both frameworks, Vue and Nuxt.js. But loading...
Read more >Adding static images to a component, they do not appear
This is a code snippet my component <img :src="logo"> export default { name: 'NavbarComponent', data: function() { return { logo: './assets/img/test.jpg' } ...
Read more >Images - React Native
Images. Static Image Resources. React Native provides a unified way of managing images and other media assets in your Android and iOS apps....
Read more >Images, fonts, and assets - Storybook - JS.ORG
In this case, you need to have all your images and media files with relative paths. Otherwise, the browser cannot locate those files....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hello @triasrahman
This problem mostly related with webpack. I can’t find any easy way to do it. You can do like:
modify main.vue file with:
and
or you can use css backgrounds.
Maybe it’s not, but I’m using the same as I wrote.
This template using vue.js, so you need to catch HTML elements inside vue. Also, if you looking image path in CSS, you can use
url('../images/image-name.jpg')
I recommend you to work with vue.js before developing an application with this template… Because of the usage of vue different than HTML and jquery.
Have a great day!
Note: Bad English and deletion of the reply message made this message bad. It was not my intention to say that the other party did not know.