[Vuejs]-How to pass url image from parent to child components in vuejs

0👍

Although your question ain’t constructive enough but I think I understand what youre trying to do.
To pass image as props to a child component, you need to import it in the Parent component script, then you can bind to it by passing it as props to the child component in the parent’s template:


// PARENT COMPONENT
<template>
  <div>
    <ChildComponent 
     :logo="logoObject"
    />
  </div>
</template>

<script>
  import ChildComponent from '../<point to child component here>'
  import logo from '../../asset/<point to image here>'
  export default(){
  data(){
    logoObject: logo
  }
}
</script>

// CHILD COMPONENT
<template>
  <div>
    <img :src="logo" />
  </div>
</template>

<script>
export default(){
 props: ['logo']
}
</script>

Leave a comment