V
V
Viorel2018-05-15 22:22:42
Vue.js
Viorel, 2018-05-15 22:22:42

Vue js failed to load images?

I'm starting to learn vue.js.
I decided to make a simple application for filtering data in the src folder created a data folder in it data.js
piece of code:

const data = [
  {
  name: 'vue js',
  //logo: '../assets/vue-logo.png',
  logo: 'https://upload.wikimedia.org/wikipedia/commons/f/f1/Vue.png',
  stack: [ 'framework', 'frontend', 'web', 'mobile' ]
  },
  {
  	name: 'react js',
  	logo: './assets/react.png',
  	stack: [ 'framework', 'frontend', 'web', 'mobile' ]
  },
 {
name: 'Slim Framework',
logo: '../assets/slim.png',
stack: [ 'backend','framework', 'web' ]
}
];
export default data;

I uploaded images to the assets folder,
if I write the path of the image in this format
logo: ' https://upload.wikimedia.org/wikipedia/commons/f/f... ',
then the image is displayed ,
and if this format is
logo: '.. /assets/vue-logo.png',
I don't understand why the images
of the project files are not displayed
5afb3324da27b353003398.png5afb333567ea3252648852.png
How to solve the problem, enlighten

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
fl3nkey, 2018-05-15
@FLUNKEY

As I understand correctly, you must specify the path relative to the site/server root file, not the JS file.
Most likely like this: /assets/vue-logo.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question