Kraken
Kraken

Reputation: 31

How to fix the "Not allowed to load local resource" Vue.js

I tried to load some icons and logos into my site using localhost, files are detected but are not loaded and it says "Not allowed to load local resource", I also tried to run the app using "npm install -g http-server" in terminal, but I had another error: "Failed to load resource: the server responded with a status of 404 (Not Found) @build.js:1"

Upvotes: 2

Views: 7179

Answers (1)

Eric
Eric

Reputation: 847

There are two common options for loading images.

Through the public folder. e.g. <img src='/image/myImageName.png'>

Note: by specifying the root directory / vue is directed to the public folder

Or through the assets folder. e.g. <img src='@/assets/images/myImageName.png'>

Note: by supplying the @ sign vue is directed to the src directory

Upvotes: 1

Related Questions