Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image not showing in vue.js and onsen ui app

I have used the following code to load image in my App which is based on Vue.js and Onsen UI . But they are not showing.

  <div class="footer_logo">
    <ul>
      <li class=""><img :src="logo" alt="logo" /></li>
    </ul>
  </div>

I have imported the image using the following code in script

import foot1 from 'static/assets/img/footerlogos/1.svg';
export default {
  data() {
      logo: foot1;
  }

Edit

Project structure

like image 210
Tasfia Sharmin Avatar asked Mar 09 '23 06:03

Tasfia Sharmin


1 Answers

svg image can be a problem first change it than check either it works or not. It it's not working follow the following solution.

you have to put all your image files in assets folder inside src folder not src/static

Test with this.

  • create assets directory inside src folder ( make sure it assets not asset or anything else )
  • add an image ex: logo.jpg

than your code

 <div class="footer_logo">
    <ul>
      <li class=""><img :src="logo" alt="logo" /></li>
    </ul>
  </div>

and finally update your script

import foot1 from 'assets/logo.jpg';
export default {
  data() {
      logo: foot1;
  }
like image 133
Sharif Chowdhury Avatar answered Mar 19 '23 01:03

Sharif Chowdhury