Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

161
Views
vue - image Url as prop not showing image

I am passing imageSrc from App.vue to HelloWorld.vue, but the image doesn't show up.

App.vue

 <HelloWorld imageSrc="./assets/logo.png" />

HelloWORLD.vue

<template>
  <div class="hello">
    <img :src="imageSrc" alt="img" />
  </div>
</template>

<script>
export default {
  name: "HelloWorld",
  props: {
    imageSrc: String,
  },
};
</script>

<style scoped>
</style>

CodeSandbox:
https://codesandbox.io/s/cocky-hofstadter-bomkf?file=/src/components/HelloWorld.vue:0-432

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

This will help you and it's working:

<template>
  <div id="app">
    <HelloWorld :imageSrc="logo" />
  </div>
</template>

<script>
import HelloWorld from "./components/HelloWorld";
import Logo from "./assets/logo.png";

export default {
  name: "App",
  components: {
    HelloWorld,
  },
  data: function () {
    return {
      logo: Logo,
    };
  },
};
</script>

Working Sandbox: https://codesandbox.io/s/dark-haze-z3b7m?file=/src/App.vue:0-331

about 4 years ago · Juan Pablo Isaza Report

0

Move your assets folder into public. It should work fine.

Here's the Demo link

From the docs

Static assets placed in the public directory and referenced via absolute paths. These assets will simply be copied and not go through webpack.

To access the static assets with absolute path, you should keep assets in public folder.

Read the documentation for more info.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!