[Vuejs]-Vue.js relative path in data

0👍

You need to import the path so that vue can figured it out where the file.

import image from "../assets/img/icon-facebook.svg"
export default {
 name: "social-media",
  data() {
    return {
       imgsource: image
    }
  },
};

or

require('../assets/img/icon-facebook.svg');

inline

 <img :src="require('../assets/img/icon-facebook.svg')"/>

Leave a comment